找回密码
 注册
搜索
免费空间 免费域名 免费AI 老牌主机商首月仅1美分!27美元/年!Spaceship优惠码 Namecheap优惠码阿里云2核2G3M新老续费同享99元/年!
查看: 139|回复: 3

[主机资源] 热点CentOS 5.x RDPM MYSQL/nginx(平滑)升级脚本

[复制链接]
发表于 2010-2-7 14:36:18 | 显示全部楼层 |阅读模式
本帖最后由 7788 于 2010-2-7 14:48 编辑

热点 RDPM SERVER 1.0介绍与安装方法见:http://www.free8.net/thread-33845-1-1.html

以下脚本只适合热点RDPM SERVER升级

本脚本只适合从热点CentOS 5.x RDPM  1.0上升级使用,因为升级有一定的风险,所以请用户备份好数据,脚本本身也有备份功能,首先确认你没有在安装热点CentOS 5.x RDPM以后修改过MYSQL数据库相关的路径

本次升级是mysql 5.1.38升级到mysql 5.1.42

升级过程中需要关闭mysql数据库,所以依赖mysql数据库的站点会出现不能正常访问的现象

1.MYSQL升级脚本
安装完成后,需要3-5分钟mysql才能正常使用!
  1. wget http://vbets.googlecode.com/files/mysql_up.sh
  2. chmod +x mysql_up.sh
  3. ./mysql_up.sh
复制代码


以下是完整代码,方便大家以后升级其他版本的mysql
脚本原代码:
  1. #! /bin/sh
  2. # copyright by WWW.7QY.COM

  3. mkdir -pv /tmp/down
  4. /usr/local/webserver/mysql/bin/mysqladmin -u root -p shutdown
  5. mv /usr/local/webserver/mysql /usr/local/webserver/mysql.5.1.38
  6. mv /wwwroot/mysql /wwwroot/mysql.5.1.38

  7. mkdir -pv /usr/local/webserver/mysql
  8. mkdir -pv /wwwroot/mysql

  9. cd /tmp/down
  10. #wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.42.tar.gz/from/http://mysql.he.net/
  11. wget http://192.168.1.5/mysql-5.1.42.tar.gz.zip
  12. mv mysql-5.1.42.tar.gz.zip  mysql-5.1.42.tar.gz
  13. tar xvf mysql-5.1.42.tar.gz
  14. cd mysql-5.1.42/
  15. ./configure --prefix=/usr/local/webserver/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
  16. make && make install
  17. chmod g-rwx,o-rwx /usr/local/webserver/mysql
  18. chown -R mysql:mysql /usr/local/webserver/mysql /wwwroot/mysql

  19. /usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/wwwroot/mysql --user=mysql

  20. cat > /wwwroot/mysql/my.cnf << EOF
  21. [client]
  22. default-character-set = utf8
  23. port    = 3306
  24. socket  = /tmp/mysql.sock

  25. [mysql]
  26. prompt="(\u:localhost:)[\d]> "
  27. no-auto-rehash

  28. [mysqld]
  29. #default-character-set = utf8
  30. user    = mysql
  31. port    = 3306
  32. socket  = /tmp/mysql.sock
  33. basedir = /usr/local/webserver/mysql
  34. datadir = /wwwroot/mysql
  35. open_files_limit    = 10240
  36. back_log = 600
  37. max_connections = 3000
  38. max_connect_errors = 6000
  39. table_cache = 614
  40. external-locking = FALSE
  41. max_allowed_packet = 32M
  42. sort_buffer_size = 2M
  43. join_buffer_size = 2M
  44. thread_cache_size = 300
  45. thread_concurrency = 8
  46. query_cache_size = 32M
  47. query_cache_limit = 2M
  48. query_cache_min_res_unit = 2k
  49. default-storage-engine = MyISAM
  50. default_table_type = MyISAM
  51. thread_stack = 192K
  52. transaction_isolation = READ-COMMITTED
  53. tmp_table_size = 246M
  54. max_heap_table_size = 246M
  55. long_query_time = 1
  56. log_long_format
  57. log-bin = /wwwroot/mysql/binlog
  58. binlog_cache_size = 4M
  59. binlog_format = MIXED
  60. max_binlog_cache_size = 8M
  61. max_binlog_size = 512M
  62. expire_logs_days = 7
  63. key_buffer_size = 256M
  64. read_buffer_size = 1M
  65. read_rnd_buffer_size = 16M
  66. bulk_insert_buffer_size = 64M
  67. myisam_sort_buffer_size = 128M
  68. myisam_max_sort_file_size = 10G
  69. myisam_max_extra_sort_file_size = 10G
  70. myisam_repair_threads = 1
  71. myisam_recover

  72. skip-name-resolve
  73. master-connect-retry = 10
  74. slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

  75. server-id = 1

  76. innodb_additional_mem_pool_size = 16M
  77. innodb_buffer_pool_size = 2048M
  78. innodb_data_file_path = ibdata1:1024M:autoextend
  79. innodb_file_io_threads = 4
  80. innodb_thread_concurrency = 8
  81. innodb_flush_log_at_trx_commit = 2
  82. innodb_log_buffer_size = 16M
  83. innodb_log_file_size = 128M
  84. innodb_log_files_in_group = 3
  85. innodb_max_dirty_pages_pct = 90
  86. innodb_lock_wait_timeout = 120
  87. innodb_file_per_table = 0
  88. [mysqldump]
  89. quick
  90. max_allowed_packet = 32M
  91. EOF

  92. cat > /wwwroot/mysql/mysqld << EOF
  93. #!/bin/sh   
  94.   
  95. function_start_mysql()   
  96. {   
  97.     printf "Starting MySQL...\n"  
  98.     /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/wwwroot/mysql/my.cnf 2>&1 > /dev/null &   
  99. }   
  100.   
  101. function_stop_mysql()   
  102. {   
  103.     printf "Stoping MySQL...\n"  
  104.     /usr/local/webserver/mysql/bin/mysqladmin -u mysqladmin -p mysqladmin -S /tmp/mysql.sock shutdown   
  105. }   
  106.   
  107. function_restart_mysql()   
  108. {   
  109.     printf "Restarting MySQL...\n"  
  110.     function_stop_mysql   
  111.     sleep 5   
  112.     function_start_mysql   
  113. }   
  114.   
  115. function_kill_mysql()   
  116. {   
  117.     kill -9 \$(ps -ef | grep 'bin/mysqld_safe' | grep /usr/local/webserver/mysql | awk '{printf \$2}')   
  118.     kill -9 \$(ps -ef | grep 'libexec/mysqld' | grep /usr/local/webserver/mysql | awk '{printf \$2}')   
  119. }   
  120.   
  121. if [ "\$1" = "start" ]; then   
  122.     function_start_mysql   
  123. elif [ "\$1" = "stop" ]; then   
  124.     function_stop_mysql   
  125. elif [ "\$1" = "restart" ]; then   
  126. function_restart_mysql   
  127. elif [ "\$1" = "kill" ]; then   
  128. function_kill_mysql   
  129. else  
  130.     printf "Usage: /wwwroot/mysql/mysqld {start|stop|restart|kill}\n"  
  131. fi  
  132. EOF

  133. mv /wwwroot/mysql /wwwroot/mysql.5.1.42
  134. mv /wwwroot/mysql.5.1.38 /wwwroot/mysql
  135. chmod +x /wwwroot/mysql/mysqld
  136. /wwwroot/mysql/mysqld start
  137. ulimit -SHn 51200
  138. /usr/local/webserver/php/sbin/php-fpm restart
  139. /usr/local/webserver/nginx/sbin/nginx
  140. cd /tmp
  141. rm -rf down
复制代码
2.只适合热点CentOS 5.x RDPM 的nginx升级,从原来的nginx0.8.29升级到0.8.33
升级前先备份你的重要文件以免出错
  1. wget http://vbets.googlecode.com/files/nginx_up.sh
  2. chmod +x nginx_up.sh
  3. ./nginx_up.sh
复制代码
本脚本也适合以后升级其他nginx版本,只要修改里面的目录和文件名就可以了

以下是脚本的内容以供参考:
  1. #! /bin/sh
  2. # copyright by WWW.7QY.COM

  3. ##########nginx up##########
  4. mkdir -pv /tmp/down
  5. cd /tmp/down
  6. wget http://nginx.org/download/nginx-0.8.33.tar.gz
  7. tar xvf nginx-0.8.33.tar.gz
  8. cd nginx-0.8.33
  9. ./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
  10. make
  11. mv /usr/local/webserver/nginx/sbin/nginx /usr/local/webserver/nginx/sbin/nginx.bak
  12. cp /tmp/down/nginx-0.8.33/objs/nginx /usr/local/webserver/nginx/sbin/
  13. killall -9 nginx;/usr/local/webserver/nginx/sbin/nginx
  14. ulimit -SHn 51200
  15. /usr/local/webserver/php/sbin/php-fpm restart
  16. /usr/local/webserver/nginx/sbin/nginx
复制代码

评分

参与人数 1银币 +5 收起 理由
pcskys + 5 热不起来。。太冷了。。。还是支持7788

查看全部评分

发表于 2010-2-7 14:42:59 | 显示全部楼层
我不懂的 都是错的
发表于 2010-2-7 14:44:13 | 显示全部楼层
好好学习天天向上!!
头像被屏蔽
发表于 2010-2-7 14:45:34 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|免费吧论坛

GMT+8, 2025-1-23 13:11 , Processed in 0.021545 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表