linux认证:apache_mysql随机启动关闭Linux认证考试
文章作者 100test 发表时间 2009:05:13 17:34:39
来源 100Test.Com百考试题网
Apache源于NCSAhttpd服务器,经过多次修改,成为世界上最流行的Web服务器软件之一。Apache取自“a patchy server”的读音,意思是充满补丁的服务器,因为它是自由软件,所以不断有人来为它开发新的功能、新的特性、修改原来的缺陷。Apache的特点是简单、速度快、性能稳定,并可做代理服务器来使用。
apache随机启动
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apached
chmod x /etc/rc.d/init.d/apached
ln -s /etc/rc.d/init.d/apached /etc/rc3.d/S100apache
ln -s /etc/rc.d/init.d/apached /etc/rc0.d/K100apache
mysql随机启动
默认配置
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
chmod x /etc/rc.d/init.d/mysql
ln -s /etc/rc.d/init.d/mysql /etc/rc3.d/S100mysql
ln -s /etc/rc.d/init.d/mysql /etc/rc0.d/K100mysql
非默认安装 比如配置在/opt/mysql_server中 创建启动文件/opt/mysql_server/start.sh
#!/bin/sh
rundir="/opt/mysql_server".
echo $rundir.
/usr/local/mysql/bin/mysqld_safe --defaults-file="$rundir"/my.cnf --pid-file="$rundir"/mysql.pid --datadir="$rundir"/data --socket="$rundir"/mysql.sock --user=mysql --log-error="$rundir"/error.log --log-slow-queries="$rundir"/slow_query.log&.
创建停止文件/opt/mysql_server/stop.sh
#!/bin/sh
rundir="/opt/mysql_server".
echo $rundir.
/usr/local/mysql/bin/mysqladmin -uroot -pctech --socket="$rundir"/mysql.sock shutdown
创建配置文件my.cnf
[mysqld]
port = 8211
skip-locking
skip-innodb
skip-name-resolve
set-variable = back_log=600
set-variable = key_buffer=4M
set-variable = max_allowed_packet=2M
set-variable = table_cache=512
set-variable = sort_buffer=16M
set-variable = record_buffer=8M
set-variable = thread_cache=32
set-variable = long_query_time=200
set-variable = wait_timeout=200
query_cache_size = 16M
query_cache_type = 1
query_cache_limit = 4M
# Try number of CPU s*2 for thread_concurrency
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=2M
set-variable = max_connections=600
set-variable = max_connect_errors=600
#log-bin
tmpdir = /tmp/
[client]
socket=/opt/mysql_server/mysql.sock
创建服务文件/opt/mysql_server/mysql_self_server
#!/bin/sh
ARGV="$@"
ERROR=0
case $ARGV in
start)
/opt/mysql_server/start.sh
ERROR=$?
..
stop)
/opt/mysql_server/stop.sh
..
*)
ERROR = "error arguments"
esac
exit $ERROR
最后
cp /opt/mysql_server/mysql_self_server /etc/rc.d/init.d/mysql_self_server
chmod x /etc/rc.d/init.d/mysql_self_server
ln -s /etc/rc.d/init.d/mysql_self_server /etc/rc3.d/S100mysql_self_server
ln -s /etc/rc.d/init.d/mysql_self_server /etc/rc0.d/K100mysql_self_server
更多优质资料尽在百考试题论坛 百考试题在线题库