快速业务通道

linux:apache_mysql随机启动关闭

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-05-02

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


凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号