1、系统初始化# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
# 关闭selinux
sed -i 's/enforcing/disabled/' /etc/selinux/config #永久
setenforce 0 # 临时
# 关闭THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
# 时间同步
yum install ntpdate -y
ntpdate time.windows.com
echo "*/5 * * * * /usr/sbin/ntpdate ntp.api.bz >/dev/null 2 >&1" >> /var/spool/cron/root
2、安装JAVA环境tar -xzf jdk-11.0.9_linux-x64_bin.tar.gz -C /usr/local/
cd /usr/local/
mv jdk-11.0.9 java
启用环境变量:
cat << EOF >> /etc/profile
JAVA_HOME=/usr/local/java
JAVA_BIN=$JAVA_HOME/bin
PATH=$PATH:$JAVA_BIN
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
EOF
然后source 使其生效
ln -vs /usr/local/java/bin/java /usr/bin/java
source /etc/profile
java -version
3、安装并配置MySQLwget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
rpm -qa | grep mariadb
rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps
tar -xvf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-8.0.28-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm --nodeps --force
rpm -qa | grep mysql
mysqld --initialize
chown mysql:mysql /var/lib/mysql -R
mkdir /data
mv /var/lib/mysql /data/
cat /etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
#skip-name-resolve
max_allowed_packet = 500M
default-character-set = UTF8MB4
[mysqld]
port = 3306
socket = /tmp/mysql.sock
datadir = /data/mysql
default-storage-engine = Innodb
character-set-server = UTF8MB4
【apollo配置中心搭建,值得收藏】collation-server=utf8mb4_general_ci
init_connect='SET NAMES utf8mb4'
performance_schema=ON
default_authentication_plugin=mysql_native_password
default-time_zone='+8:00'
skip_name_resolve = ON
myisam-recover-options
#skip-grant-tables
connect_timeout = 300
key_buffer_size = 768M
max_allowed_packet = 64M
table_open_cache = 400000
join_buffer_size = 128M
sort_buffer_size = 1M
read_buffer_size = 4M
read_rnd_buffer_size = 64M
net_buffer_length = 64K
myisam_sort_buffer_size = 2M
myisam_max_sort_file_size = 256M
#myisam_repair_threads = 1
max_connections = 1000
max_connect_errors = 30000
max_heap_table_size = 256M
wait_timeout = 7200
interactive_timeout = 7200
thread_cache_size = 128
thread_stack = 512k
tmp_table_size = 384M
#back_log = 500
#binlog-cache-size = 4M
binlog_format = Mixed
#binlog_format = ROW
binlog_expire_logs_seconds = 259200
bulk_insert_buffer_size = 256M
long_query_time = 2
slow_query_log = 1
#log-queries-not-using-indexes
#slow_query_log_file = /data/logs/mysql.slow.txt
log_bin = mysql-bin
log_replica_updates = ON
binlog_cache_size = 67108864 #binlog缓存大小 64M
sync_binlog = 100
binlog_stmt_cache_size = 67108864
#innodb_dedicated_server=ON
relay_log=mysql-relay-bin
#auto_increment_increment=1 #步进值 , 主节点数量
#auto_increment_offset=1 #起始值 , 一般填写第n台主机mysql , 第二台填写2
replica_parallel_workers=100
replica_parallel_type=LOGICAL_CLOCK
replica_preserve_commit_order=on
#log_bin_trust_function_creators
open_files_limit = 65000
log-error = /data/mysql/mysql.error
#general_log = ON
innodb_file_per_table = ON
innodb_data_home_dir = /data/mysql
innodb_data_file_path = ibdata1:12M:autoextend
innodb_buffer_pool_size = 5G
innodb_log_file_size = 1024M
innodb_log_buffer_size = 1024M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_io_capacity = 1000
innodb_io_capacity_max = 4000
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
innodb_open_files = 60000
innodb_rollback_on_timeout = ON
innodb_print_all_deadlocks = ON
innodb_online_alter_log_max_size = 1G
innodb_buffer_pool_load_at_startup = ON
innodb_buffer_pool_dump_at_shutdown = ON
推荐阅读
- 新电脑配置不低却还是卡顿,你知道原因吗?
- 旧电脑升级配置,应该动哪里?
- kubernetes ingress配置转发端口
- 华为交换机配置跨网段通过vlanif通信,二层隔离三层通信
- Maven配置多个仓库共同使用的方法
- 买电脑,应该关心的6个配置!哪种电脑不能买?
- linux-centos网络配置bond
- 虹桥世界中心房地产详情
- Centos6下网卡启动、配置ifcfg-eth0教程
- 配置与 Hyper-V 虚拟机的远程桌面连接