Cacti和Zabbix所需Mysql安装配置
注:此篇文章的部分内容摘抄自公司同事编写的技术文档,在此对他致以衷心的谢意!Cacti、Nagios、Zabbix都是生产环境常用的监控软件,为了整合资源便于管理一般都将这三种监控软件整合到一台服务器中,下面是工作中总结的适合Cacti、Zabbix、Nagios的编译参数和基本配置方法,希望对大家有帮助。
1. mysql编译和安装配置(mysql-5.1.58)
[*]./configure \
[*]--prefix=/usr/local/mysql-5.1.58 \
[*]--enable-assembler \
[*]--with-libwrap=/usr/lib/ \
[*]--with-charset=utf8 \
[*]--with-extra-charsets=gb2312,gbk,big5,latin1,utf8 \
[*]--with-mysqld-user=mysql \
[*]--without-debug \
[*]--with-big-tables \
[*]--enable-thread-safe-client \
[*]--with-client-ldflags=-all-static \
[*]--with-plugins=myisam,myisammrg,innodb_plugin
[*]
[*]make && make install
[*]
[*]cd /usr/local; ln -s mysql-5.1.58 mysql
[*]
[*]cd /src/mysql-5.1.58; /bin/cp -pfr support-files /usr/local/mysql/
groupadd mysql; useradd mysql -g mysql
[*]mkdir -p /data/mysql/{data,ibdata,log}
[*]chown -R mysql:mysql /data/mysql
[*]
2. mysql配置文件
[*]
[*]port = 3306
[*]socket = /tmp/mysql.sock
[*]
[*]
[*]port = 3306
[*]socket = /tmp/mysql.sock
[*]character-set-server=utf8
[*]init_connect='set names utf8'
[*]skip-name-resolve
[*]basedir = /usr/local/mysql
[*]datadir = /data/mysql/data
[*]back_log = 50
[*]max_connections = 600
[*]max_connect_errors = 10
[*]skip-external-locking
[*]max_heap_table_size = 64M
[*]sort_buffer_size = 8M
[*]join_buffer_size = 8M
[*]thread_cache_size = 8
[*]thread_concurrency = 8
[*]query_cache_size = 64M
[*]query_cache_limit = 2M
[*]ft_min_word_len = 4
[*]default-storage-engine = InnoDB
[*]thread_stack = 192K
[*]transaction_isolation = REPEATABLE-READ
[*]tmp_table_size = 64M
[*]long_query_time = 5
[*]log-error
[*]slow_query_log
[*]server-id = 1
[*]key_buffer_size = 32M
[*]read_buffer_size = 8M
[*]read_rnd_buffer_size = 16M
[*]bulk_insert_buffer_size = 64M
[*]myisam_sort_buffer_size = 128M
[*]myisam_max_sort_file_size = 10G
[*]myisam_repair_threads = 1
[*]myisam_recover
[*]ignore-builtin-innodb
[*]plugin-load=innodb=ha_innodb_plugin.so
[*]plugin_dir=/usr/local/mysql/lib/mysql/plugin
[*]innodb_file_format=barracuda
[*]innodb_additional_mem_pool_size = 20M
[*]innodb_buffer_pool_size = 1G
[*]innodb_data_file_path = ibdata1:20M:autoextend
[*]innodb_file_per_table = 1
[*]innodb_data_home_dir = /data/mysql/ibdata
[*]innodb_file_io_threads = 4
[*]innodb_thread_concurrency = 16
[*]innodb_flush_log_at_trx_commit = 0
[*]innodb_log_buffer_size = 8M
[*]innodb_log_file_size = 1024M
[*]innodb_log_files_in_group = 2
[*]innodb_log_group_home_dir = /data/mysql/ibdata
[*]innodb_max_dirty_pages_pct = 90
[*]innodb_flush_method=O_DSYNC
[*]innodb_lock_wait_timeout = 120
[*]innodb_open_files = 300
[*]
[*]
[*]quick
[*]max_allowed_packet = 32M
[*]
[*]
[*]no-auto-rehash
[*]
[*]
[*]key_buffer_size = 512M
[*]sort_buffer_size = 512M
[*]read_buffer = 8M
[*]write_buffer = 8M
[*]
[*]
[*]interactive-timeout
[*]record_buffer = 16773120
[*]
[*]
[*]open-files-limit = 8192
3. 初始化系统库配置启动脚本
[*]cd /usr/local/mysql; bin/mysql_install_db --user=mysql
[*]
[*]/bin/cp -rf /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[*]chmod +x /etc/init.d/mysqld
[*]chkconfig --add mysqld
[*]chkconfig mysqld on
[*]service mysqld start
4. 设置环境变量
[*]echo "export MYSQL_HOME=/usr/local/mysql " >> /etc/profile;
[*]echo "export PATH=$PATH:$MYSQL_HOME/bin" >> /etc/profile;
[*]echo "export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/lib64:/usr/local/lib:$MYSQL_HOME/lib/mysql" >> /etc/profile
[*]source /etc/profile
5. 设置mysql的root密码
[*]/usr/local/mysql/bin/mysqladmin -u root password 'q1w2e3r4'
[*]/usr/local/mysql/bin/mysqladmin -u root -h 127.0.0.1 password 'q1w2e3r4'
页:
[1]