你好,游客 登录 注册 搜索
背景:
阅读新闻

LNAMP第二版(Nginx 1.2.0+Apache 2.4.2+PHP 5.4)

[日期:2012-05-09] 来源:Linux社区  作者:kerry [字体:大 中 小]

#============== Install mysql 5.5.23 ==================#
#使用Tcmalloc 优化nginx、mysql
#64位操作系统请先安装 libunwind库,32位操作系统不要安装。libunwind库为基于64位CPU和操作系统的程序提供了基本的堆栈辗转开解功能,其中包括用于输出堆栈跟踪的API、用于以编程方式辗转开解堆栈的API以及支持C++异常处理机制的API

  1. cd /opt  
  2. tar -zxvf libunwind-1.0.1.tar.gz  
  3. cd libunwind-1.0.1  
  4. ./configure  
  5. make;make install  
  6. cd ../  
  7.  
  8. tar -zxvf gperftools-2.0.tar.gz  
  9. cd gperftools-2.0  
  10. ./configure  
  11. make;make install  
  12.  
  13. echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf  
  14. /sbin/ldconfig  
  15. cd ../  
  16.  
  17. tar -zxvf cmake-2.8.8.tar.gz  
  18. cd cmake-2.8.8  
  19. ./bootstrap  
  20. gmake  
  21. gmake install  
  22. cd ../  
  23.  
  24. /usr/sbin/groupadd mysql  
  25. /usr/sbin/useradd -g mysql mysql -s /sbin/nologin  
  26. mkdir -p /data/mysql/{data,binlog,relaylog,mysql}  
  27. chown -R mysql:mysql /data/mysql  
  28. cd /opt  
  29. tar zxvf mysql-5.5.23.tar.gz  
  30. cd mysql-5.5.23/  
  31. rm -rf CMakeCache.txt  
  32. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \  
  33. -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \  
  34. -DDEFAULT_CHARSET=utf8 \  
  35. -DDEFAULT_COLLATION=utf8_general_ci \  
  36. -DEXTRA_CHARSETS=all \  
  37. -DWITH_MYISAM_STORAGE_ENGINE=1 \  
  38. -DWITH_INNOBASE_STORAGE_ENGINE=1 \  
  39. -DWITH_READLINE=1 \  
  40. -DENABLED_LOCAL_INFILE=1 \  
  41. -DMYSQL_DATADIR=/data/mysql/data \  
  42. -DMYSQL_TCP_PORT=3306   
  43. make;make install  
  44. chmod +w /usr/local/mysql  
  45. chown -R mysql:mysql /usr/local/mysql  
  46. ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18 

#编辑mysql配置文件

  1. cat >> /etc/my.cnf <<EOF 
  2. [client]  
  3. port    = 3306 
  4. socket  = /data/mysql/mysql.sock  
  5.  
  6. [mysqld]  
  7. character_set_server = utf8 
  8. collation-server = utf8_general_ci 
  9. replicate-ignore-db = mysql 
  10. replicate-ignore-db = test 
  11. replicate-ignore-db = information_schema 
  12. user    = mysql 
  13. port    = 3306 
  14. socket  = /data/mysql/mysql.sock  
  15. basedir = /usr/local/mysql  
  16. datadir = /data/mysql/data  
  17. log-error = /data/mysql/mysql_error.log  
  18. pid-file = /data/mysql/mysql.pid  
  19. open_files_limit    = 10240 
  20. back_log = 600 
  21. max_connections = 5000 
  22. max_connect_errors = 6000 
  23. table_cache = 512 
  24. external-locking = FALSE 
  25. max_allowed_packet = 32M 
  26. sort_buffer_size = 6M 
  27. join_buffer_size = 8M 
  28. thread_cache_size = 300 
  29. thread_concurrency = 8 
  30. query_cache_size = 512M 
  31. query_cache_limit = 2M 
  32. query_cache_min_res_unit = 2k 
  33. default-storage-engine = MyISAM 
  34. thread_stack = 256K 
  35. transaction_isolation = READ-COMMITTED  
  36. tmp_table_size = 256M 
  37. max_heap_table_size = 256M 
  38. long_query_time = 3 
  39. log-slave-updates  
  40. log-bin = /data/mysql/binlog/binlog  
  41. binlog_cache_size = 4M 
  42. binlog_format = MIXED 
  43. max_binlog_cache_size = 8M 
  44. max_binlog_size = 100M 
  45. relay-log-index = /data/mysql/relaylog/relaylog  
  46. relay-log-info-file = /data/mysql/relaylog/relaylog  
  47. relay-log = /data/mysql/relaylog/relaylog  
  48. expire_logs_days = 30 
  49. key_buffer_size = 384M 
  50. read_buffer_size = 4M 
  51. read_rnd_buffer_size = 16M 
  52. bulk_insert_buffer_size = 64M 
  53. myisam_sort_buffer_size = 128M 
  54. myisam_max_sort_file_size = 10G 
  55. myisam_repair_threads = 1 
  56. myisam_recover  
  57.  
  58. interactive_timeout = 120 
  59. wait_timeout = 120 
  60.  
  61. skip_external_locking  
  62. skip-name-resolve  
  63. #master-connect-retry = 10 
  64. slave-skip-errors = 1032,1062,126,1114,1146,1048,1396  
  65.  
  66. #master-host     =   192.168.1.2  
  67. #master-user     =   username 
  68. #master-password =   password  
  69. #master-port     =  3306 
  70.  
  71. server-id = 1 
  72.  
  73. skip-innodb  
  74.  
  75. #log-slow-queries = /data/mysql/slow.log  
  76. #long_query_time = 10 
  77.  
  78. [mysqldump]  
  79. quick  
  80. max_allowed_packet = 32M 
  81. EOF 

#初始化mysql

  1. /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql 
linux
相关资讯       LNAMP 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款