yum -y update
|
sed -i "s/SELINUX= enforcing/SELINUX= disabled/g" /etc/selinux/config
|
systemctl stop firewalld.service && systemctl disable firewalld.service
|
firewall-cmd --zone= public --list-interfaces
firewall-cmd --zone= public --permanent --add- interface =eth0
firewall-cmd --zone= public --add-port= 10050 /tcp --permanent
firewall-cmd --zone= public --add-port= 10050 /udp --permanent
firewall-cmd --set- default -zone= public
firewall-cmd --complete-reload
|
vi /etc/security/limits.conf,增加以下内容
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
|
vi /etc/sysctl.conf,增加以下内容
vm.swappiness = 1
|
vi /etc/yum.repos.d/MariaDB.repo,增加以下内容
[mariadb]
name = MariaDB
baseurl =http: //mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/
gpgkey=https: //mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck= 1
|
systemctl enable mariadb && systemctl start mariadb
|
mysql_secure_installation
|
systemctl stop mariadb
|
vim /etc/my.cnf.d/server.cnf,在 [mysqld] 字段下增加以下内容
port = 3306
socket = /var/lib/mysql/mysql.sock
user = mysql
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
character-set-client-handshake = 0
init_connect = 'SET NAMES utf8mb4'
max_connections = 1000
connect_timeout = 60
wait_timeout = 600
interactive_timeout = 600
lock_wait_timeout = 3600
skip_name_resolve = 1
skip_external_locking = 1
open_files_limit = 65535
explicit_defaults_for_timestamp = 1
pid_file = zabbix.pid
log_error = zabbix.err
slow_query_log = 1
slow_query_log_file = zabbix.slow
key_buffer_size = 1M
read_buffer_size = 4M
read_rnd_buffer_size = 2M
table_open_cache = 1024
table_definition_cache = 1024
table_open_cache_instances = 64
thread_cache_size = 512
sort_buffer_size = 4M
join_buffer_size = 4M
bulk_insert_buffer_size = 64M
tmp_table_size = 32M
max_heap_table_size = 32M
query_cache_limit = 0
query_cache_size = 0
symbolic-links = 0
max_allowed_packet = 32M
bind-address = 0.0 . 0.0
# 如果需要开启复制或搭建高可用,则以下 7 行内容需要启用,否则禁用
#log_bin = mariadb1-bin
#binlog_format = ROW
# 如果对数据完整性要求高,则
sync_binlog = 1
#sync_binlog = 0
#binlog_cache_size = 4M
#max_binlog_cache_size = 1G
#max_binlog_size = 1G
#expire_logs_days = 7
innodb_strict_mode = off
innodb_buffer_pool_size = 6G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_log_file_size = 1G
innodb_log_buffer_size = 32M
innodb_log_files_in_group = 2
# 如果对数据完整性要求高,则 innodb_flush_log_at_trx_commit = 1
innodb_flush_log_at_trx_commit = 0
innodb_lock_wait_timeout = 10
innodb_autoinc_lock_mode = 2
innodb_doublewrite = 1
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_io_capacity = 2000
innodb_io_capacity_max = 4000
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
innodb_page_cleaners = 4
innodb_open_files = 65535
innodb_max_dirty_pages_pct = 50
innodb_lru_scan_depth = 4000
innodb_status_file = 1
innodb_change_buffer_max_size = 50
# 有性能监控要求的,则开启以下参数,否则禁用
performance_schema = 1
performance_schema_instrument = '%=on'
innodb_monitor_enable = "module_srv"
innodb_monitor_enable = "module_os"
innodb_monitor_enable = "module_lock"
innodb_monitor_enable = "module_buffer"
innodb_monitor_enable = "module_buf_page"
innodb_monitor_enable = "module_trx"
innodb_monitor_enable = "module_purge"
innodb_monitor_enable = "module_file"
innodb_monitor_enable = "module_index"
innodb_monitor_enable = "module_adaptive_hash"
innodb_monitor_enable = "module_ibuf_system"
innodb_monitor_enable = "module_ddl"
innodb_monitor_enable = "module_dml"
innodb_monitor_enable = "module_log"
innodb_monitor_enable = "module_icp"
innodb_monitor_enable = "module_metadata"
|
vim /etc/my.cnf.d/mysql-clients.cnf,
在 [mysql] 字段下增加以下内容
prompt = "\U[\R:\m][\d]> "
no-auto-rehash
default -character-set = utf8mb4
user=root
password=Qingdao, 2018 # 此处就是第 12 步设置的 MariaDB root 密码
在 [mysqldump] 字段下增加以下内容
quick
|
systemctl stop mariadb && reboot
|
yum -y update
|
sed -i "s/SELINUX= enforcing/SELINUX= disabled/g" /etc/selinux/config
|
systemctl stop firewalld.service && systemctl disable firewalld.service
|
firewall-cmd --zone= public --list-interfaces
firewall-cmd --zone= public --permanent --add- interface =eth0
firewall-cmd --zone= public --add-port= 10050 /tcp --permanent
firewall-cmd --zone= public --add-port= 10050 /udp --permanent
firewall-cmd --set- default -zone= public
firewall-cmd --complete-reload
|
vi /etc/security/limits.conf,增加以下内容
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
|
vi /etc/sysctl.conf,增加以下内容
vm.swappiness = 1
|
vi /etc/yum.repos.d/MariaDB.repo,增加以下内容
[mariadb]
name = MariaDB
baseurl =
http: //mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/
gpgkey=https: //mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck= 1
|
systemctl disable postfix.service && rpm -e --nodeps postfix
|
yum -y install zabbix-server-mysql zabbix-web-mysql
|
vim /etc/zabbix/zabbix_server.conf,主要是以下几个选项参数需要设置(以 8GB 内存为例)DBHost=数据库主机IP地址
DBPassword 配置为第 14 步中设置的自定义密码
CacheSize=512M
HistoryCacheSize=128M
HistoryIndexCacheSize=128M
TrendCacheSize=128M
ValueCacheSize=256M
Timeout= 30
|
StartVMwareCollectors= 2
VMwareCacheSize=256M
VMwareTimeout= 300
|
vim /etc/httpd/conf.d/zabbix.conf
max_execution_time 600
memory_limit 256M
post_max-size 32M
upload_max_filesize 32M
max_input_time 600
date.timezone 去掉注释符号#,并将值修改为 Asia/Shanghai
|
reboot
|
systemctl start httpd && systemctl start zabbix-server
|
msyhvim /usr/share/zabbix/include/defines.inc.php
|
systemctl enable httpd && systemctl enable zabbix-server && systemctl restart httpd && systemctl restart zabbix-server
|