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
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
vm.swappiness = 1
[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
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_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”
prompt = “\U[\R:\m][\d]> ”
no-auto-rehash
default-character-set = utf8mb4
user=root
password=Qingdao,2018 # 此处就是第 12 步设置的 MariaDB root 密码
在 [mysqldump] 字段下增加以下内容
quick
1、原则上 innodb_buffer_pool_size 需要设置为主机内存的 80%,如果主机内存不是 8GB,以上参数可依据相应比例进行调整,例如主机内存为 16GB,则 innodb_buffer_pool_size 建议设置为 12GB。请注意innodb_buffer_pool_size的值必须是整数,例如主机内存是4G,那么innodb_buffer_pool_size可以设置为3G,而不能设置为3.2G
2、本设置以提升数据库性能为目标,降低了数据安全性。如果要保证数据安全,需对部分参数进行调整,具体请参考 MariaDB 官方文档中的相关内容,本文不展开讨论
mysql
mysql>create database zabbix character set utf8;
mysql>create user zabbix@’应用端主机IP’ identified by ‘Qingdao,2018′;
mysql>grant all privileges on zabbix.* to zabbix@’应用端主机IP’;
mysql>flush privileges;
mysql>exit;
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
scp create.sql.gz root@数据库主机IP地址:/root/
rm -rf /root/create.sql.gz
DBPassword 配置为第 14 步中设置的自定义密码
CacheSize=512M
HistoryCacheSize=128M
HistoryIndexCacheSize=128M
TrendCacheSize=128M
ValueCacheSize=256M
Timeout=30
VMwareCacheSize=256M
VMwareTimeout=300
memory_limit 256M
post_max-size 32M
upload_max_filesize 32M
max_input_time 600
date.timezone 去掉注释符号#,并将值修改为 Asia/Shanghai