国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

MySQL8.xx一主兩從復(fù)制安裝與配置

這篇具有很好參考價(jià)值的文章主要介紹了MySQL8.xx一主兩從復(fù)制安裝與配置。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

docker實(shí)戰(zhàn)(一):centos7 yum安裝docker

docker實(shí)戰(zhàn)(二):基礎(chǔ)命令篇

docker實(shí)戰(zhàn)(三):docker網(wǎng)絡(luò)模式(超詳細(xì))

docker實(shí)戰(zhàn)(四):docker架構(gòu)原理

docker實(shí)戰(zhàn)(五):docker鏡像及倉庫配置

docker實(shí)戰(zhàn)(六):docker 網(wǎng)絡(luò)及數(shù)據(jù)卷設(shè)置

docker實(shí)戰(zhàn)(七):docker 性質(zhì)及版本選擇

認(rèn)知升維: 道、法、術(shù)、器、勢(shì)


多臺(tái)服務(wù)器間免密登錄|免密拷貝

Cenos7 搭建Minio集群部署服務(wù)器(一)

Cenos7 搭建Minio集群Nginx統(tǒng)一訪問入口|反向動(dòng)態(tài)代理(二)?

Spring Boot 與Minio整合實(shí)現(xiàn)文件上傳與下載(三)?

CentOS7的journalctl日志查看方法

MySQL8.xx一主兩從復(fù)制安裝與配置

MySQL8.0.30執(zhí)行語句異常:1055 - Expression

MySQL8.0.30一主兩從復(fù)制與配置(一)

MySQL8.XX隨未生成隨機(jī)密碼解決方案


Mysql的主從復(fù)制中主要有三個(gè)線程:

master(binlog dump thread)、slave(I/O thread 、SQL thread),Master一條線程和Slave中的兩條線程。

master(binlog dump thread)主要負(fù)責(zé)Master庫中有數(shù)據(jù)更新的時(shí)候,會(huì)按照binlog格式,將更新的事件類型寫入到主庫的

binlog文件中。并且,Master會(huì)創(chuàng)建log dump線程通知Slave主庫中存在數(shù)據(jù)更新,這就是為什么主庫的binlog日志一定要開啟的原因。

I/O thread線程在Slave中創(chuàng)建,該線程用于請(qǐng)求Master,Master會(huì)返回binlog的名稱以及當(dāng)前數(shù)據(jù)更新的位置、binlog文件位置的副本。

然后,將binlog保存在 「relay log(中繼日志)」 中,中繼日志也是記錄數(shù)據(jù)更新的信息。

SQL線程也是在Slave中創(chuàng)建的,當(dāng)Slave檢測(cè)到中繼日志有更新,就會(huì)將更新的內(nèi)容同步到Slave數(shù)據(jù)庫中,這樣就保證了主從的數(shù)據(jù)的同步。

以上就是主從復(fù)制的過程,當(dāng)然,主從復(fù)制的過程有不同的策略方式進(jìn)行數(shù)據(jù)的同步,主要包含以下幾種:


「同步策略」:Master會(huì)等待所有的Slave都回應(yīng)后才會(huì)提交,這個(gè)主從的同步的性能會(huì)嚴(yán)重的影響。
「半同步策略」:Master至少會(huì)等待一個(gè)Slave回應(yīng)后提交
「異步策略」:Master不用等待Slave回應(yīng)就可以提交。
「延遲策略」:Slave要落后于Master指定的時(shí)間。


MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

搭建環(huán)境:?

查看系統(tǒng)版本
cat /etc/redhat-release

[root@www tools]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

查看內(nèi)核版本
cat /proc/version

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端目標(biāo): 一主兩從

? ? ? 主機(jī)IP 主機(jī)名稱 ? ?端口 ? ? ? ? ? ? ??搭建環(huán)境 ? ? 安裝目錄|節(jié)點(diǎn)類型
192.168.1.100 ?docker0 ? 3306 CentOS Linux release 7.9.2009?

/usr/local/mysql8? | master

192.168.1.101 ?docker1 ? ?3306 CentOS Linux release 7.9.2009?

/usr/local/mysql8? | slave

192.168.1.102 ?docker2 ? ?3306 CentOS Linux release 7.9.2009?

/usr/local/mysql8? | slave


MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

檢查MariaDB并移除:

[root@www etc]# rpm -qa | grep mariadb.*
mariadb-libs-5.5.68-1.el7.x86_64
[root@www etc]# yum remove mariadb-libs-5.5.68-1.el7.x86_64 ?-y

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端


?一: 下載對(duì)應(yīng)的版本:

[root@www tools]#

wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端


[root@www tools]# mkdir -p /usr/local/mysql8

1.1解壓過程也分為兩層:

[root@www tools]# tar ?-xvf mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz?

或者??

xz -d mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz?

或者?

tar? -xvf?mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz

之后就會(huì)出現(xiàn)mysql-8.0.30-linux-glibc2.12-x86_64.tar文件;然后tar xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar即可完成解壓

解壓?mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz 至?/usr/local/mysql8

[root@www tools]# tar xvf mysql-8.0.30-linux-glibc2.12-x86_64.tar ?-C /usr/local/mysql8/


MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端


1.2重新命名:

? ?[root@www mysql8]# mv mysql-8.0.30-linux-glibc2.12-x86_64 mysql-8.0.30

1.3創(chuàng)建mysql組和mysql用戶

? ?[root@www mysql8]# groupadd mysql
? ?[root@www mysql8]# useradd -r -g mysql mysql

1.4創(chuàng)建軟連接實(shí)現(xiàn)可直接命令行執(zhí)行mysql

[root@www bin]# ln -s /usr/local/mysql8/mysql-8.0.30/bin/mysql /usr/bin

或:

將命令加入環(huán)境變量

#vim /etc/profile

MYSQL_HOME=/usr/local/mysql8/mysql-8.0.30

export PATH=$MYSQL_HOME/bin:$PATH

# source /etc/profile

1.5創(chuàng)建mysql工作目錄

[root@www bin]# mkdir -p /usr/local/mysql8/mysql-8.0.30/data
[root@www bin]# mkdir -p /usr/local/mysql8/mysql-8.0.30/log
[root@www bin]# mkdir -p /usr/local/mysql8/mysql-8.0.30/binlog
[root@www bin]# mkdir -p /usr/local/mysql8/mysql-8.0.30/config
[root@www bin]# mkdir -p /usr/local/mysql8/mysql-8.0.30/tmp

1.6賦權(quán)限給相關(guān)目錄|將mysql目錄的權(quán)限授給mysql用戶和mysql組

[root@www msql-8.0.30]# ?chmod -R 777 /usr/local/mysql8

[root@www msql-8.0.30]# chown -R mysql:mysql /usr/local/mysql8

1.7新建配置文件

配置最小初始化內(nèi)容如下:

[root@www log]# cat /etc/my.cnf?
?

[mysql]
# 設(shè)置mysql客戶端默認(rèn)字符集
default-character-set=utf8mb4
[client]
# 設(shè)置mysql客戶端連接服務(wù)端時(shí)默認(rèn)使用的端口
port=3306
default-character-set=utf8mb4
[mysqld]?
#character config
character_set_server=utf8mb4
#設(shè)置端口
port=3306
explicit_defaults_for_timestamp=true
# 允許最大連接數(shù)
max_connections=1000
#設(shè)置mysql安裝目錄
datadir=/usr/local/mysql8/mysql-8.0.30
# 設(shè)置mysql數(shù)據(jù)庫的數(shù)據(jù)的存放目錄
datadir=/usr/local/mysql8/mysql-8.0.30/data
# 允許連接失敗的次數(shù)。這是為了防止有人從該主機(jī)試圖攻擊數(shù)據(jù)庫系統(tǒng)
max_connect_errors=100

# 每次commit 日志緩存中的數(shù)據(jù)刷到磁盤中。通常設(shè)置為 1,意味著在事務(wù)提交前日志已被寫入磁盤, 事務(wù)可以運(yùn)行更長(zhǎng)以及服務(wù)崩潰后的修復(fù)能力
innodb_flush_log_at_trx_commit=1
# 創(chuàng)建新表時(shí)將使用的默認(rèn)存儲(chǔ)引擎
default-storage-engine=INNODB
# 是否對(duì)sql語句大小寫敏,1表示不敏感 (注意:這個(gè)在mysql8中已經(jīng)無法在配置文件中修改了,只有在初始化的時(shí)候進(jìn)行配置,且如果初始化時(shí)配置了該屬性,則在本配置文件中必須要有該屬性的設(shè)置,否則啟動(dòng)報(bào)錯(cuò)。意思就是要么兩個(gè)地方都配置,要么這里也不要配置。不然迎接你的只有報(bào)錯(cuò))
#lower_case_table_names = 1
#MySQL連接閑置超過一定時(shí)間后(單位:秒)將會(huì)被強(qiáng)行關(guān)閉
#MySQL默認(rèn)的wait_timeout ?值為8個(gè)小時(shí), interactive_timeout參數(shù)需要同時(shí)配置才能生效
interactive_timeout = 1800
wait_timeout = 1800
#Metadata Lock最大時(shí)長(zhǎng)(秒), 一般用于控制 alter操作的最大時(shí)長(zhǎng)sine mysql5.6
#執(zhí)行 DML操作時(shí)除了增加innodb事務(wù)鎖外還增加Metadata Lock,其他alter(DDL)session將阻塞
lock_wait_timeout = 3600
#內(nèi)部?jī)?nèi)存臨時(shí)表的最大值。
#比如大數(shù)據(jù)量的group by ,order by時(shí)可能用到臨時(shí)表,
#超過了這個(gè)值將寫入磁盤,避免系統(tǒng)IO壓力增大,默認(rèn)16M
tmp_table_size = 64M
max_heap_table_size = 64M

# 配置密碼插件使用低版本
default_authentication_plugin=mysql_native_password
# pid-file文件配置
pid-file=/usr/local/mysql8/mysql-8.0.30/mysqld.pid
# 配置日志目錄
log_error=/usr/local/mysql8/mysql-8.0.30/log/mysql-error.log
slow_query_log_file=/usr/local/mysql8/mysql-8.0.30/log/mysql-slow.log
# 設(shè)置SQL模式
sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
#不限制導(dǎo)入導(dǎo)出 任意目錄/temp/data/
secure_file_priv='/temp/data'


1.8初始化,并記住隨機(jī)生成的密碼

[root@www bin]# ./mysqld --initialize --console? ? ?這個(gè)等同于下面的第一個(gè)命令

# 數(shù)據(jù)庫初始化-區(qū)分大小寫
./mysqld --user=mysql --basedir=/usr/local/mysql8/mysql-8.0.30 --datadir=/usr/local/mysql8/mysql-8.0.30/data/ --initialize

# 數(shù)據(jù)庫初始化-不區(qū)分大小寫
./mysqld --user=mysql --lower-case-table-names=1 --basedir=/usr/local/mysql8/mysql-8.0.30 --datadir=/usr/local/mysql8/mysql-8.0.30/data/ --initialize

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

修改SELINUX=disabled

[root@www bin]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# ? ? enforcing - SELinux security policy is enforced.
# ? ? permissive - SELinux prints warnings instead of enforcing.
# ? ? disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# ? ? targeted - Targeted processes are protected,
# ? ? minimum - Modification of targeted policy. Only selected processes are protected.?
# ? ? mls - Multi Level Security protection.
SELINUXTYPE=targeted?


1.9添加開機(jī)啟動(dòng)mysql服務(wù)和啟動(dòng)mysql服務(wù)?制作啟動(dòng)服務(wù)腳本

[root@www data]# cat /usr/lib/systemd/system/mysql.service
[Unit]
Description=MySQL Server
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql8/mysql-8.0.30/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
#Restart=on-failure
#RestartPreventExitStatus=1
#PrivateTmp=false


[root@www data]# systemctl daemon-reload

[root@www data]# systemctl start mysql
[root@www data]# systemctl status mysql

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

已啟動(dòng),但是有幾個(gè)警告:?

[Warning] [MY-000054]

[Server]

World-writable config file '/usr/local/mysql8/msyql-8.0.30/data/auto.cnf' is ignored.

[Warning] [MY-010107]

[Server]

World-writable config file '/usr/local/mysql8/mysql-8.0.30/data/auto.cnf' has been removed.

大概意思是權(quán)限全局可寫,任何一個(gè)用戶都可以寫。mysql擔(dān)心這種文件被其他用戶惡意修改,所以忽略掉這個(gè)配置文件。導(dǎo)致無法進(jìn)入,這也是mysql的安全機(jī)制之一。所以我們必須得改一些權(quán)限。設(shè)置其他用戶不可寫

[root@www data]# chmod -R 644 /usr/local/mysql8/mysql-8.0.30/data/auto.cnf
重新啟動(dòng):

[root@www data]# systemctl restart mysql
[root@www data]# systemctl status mysql

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

?上面的警告已解決:

查看下啟動(dòng)日志

[root@www data]# journalctl -xe

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

2.0使用先前生成的隨機(jī)密碼登錄msql:

[root@www ~]# mysql -u root -pMySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

重置初始密碼, 才能操作數(shù)據(jù)庫相關(guān)命令

mysql> ?set PASSWORD = 'mysql123456'?;

2.1開啟mysql的遠(yuǎn)程訪問權(quán)限

mysql> create user 'root'@'%' identified by 'mysql123456';
Query OK, 0 rows affected (0.02 sec)

mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.01 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> ?select host,user,plugin,authentication_string from user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host ? ? ?| user ? ? ? ? ? ? | plugin ? ? ? ? ? ? ? ?| authentication_string ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| % ? ? ? ? | root ? ? ? ? ? ? | mysql_native_password | *CAAA3AD851D5FFA9E5BDB96CA06F73633A3BA831 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
| localhost | mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.session ? ?| caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.sys ? ? ? ?| caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | root ? ? ? ? ? ? | caching_sha2_password | $A$005$^xy\V ?{<+_"Y=e?? ?>0qt2GXCJXB2wZqdGd4DmBSmUnaK/buocKhiZcurZ158 |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)
客戶端遠(yuǎn)程連接:

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

拓展:分別執(zhí)行下面的命令:

mysql> ?show variables like '%files%';

mysql> show variables like '%connections%';
mysql> show variables like '%table_open_cache%';
Query OK, 0 rows affected (0.01 sec)
MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端

2.2MySQL8.0.30啟動(dòng)警告:

[Warning] [MY-010139] [Server] Changed limits: max_open_files: 5000 (requested 8210)?

[Warning] [MY-010139] [Server] Changed limits: max_open_files: 5000 (requested 8210)

后續(xù)可以真對(duì)這些參數(shù)進(jìn)行調(diào)優(yōu):


繼續(xù)完善my.cnf文件

# 是否對(duì)sql語句大小寫敏感,1表示不敏感 (注意:這個(gè)在mysql8中已經(jīng)無法在配置文件中修改了,只有在初始化的時(shí)候進(jìn)行配置,且如果初始化時(shí)配置了該屬性,則在本配置文件中必須要有該屬性的設(shè)置,否則啟動(dòng)報(bào)錯(cuò)。意思就是要么兩個(gè)地方都配置,要么這里也不要配置。不然迎接你的只有報(bào)錯(cuò))
lower_case_table_names = 1? ? 配置該參數(shù)后,重啟報(bào)錯(cuò),查看日志如下:

MySQL8.xx一主兩從復(fù)制安裝與配置,服務(wù)器,運(yùn)維,后端


看看操作系統(tǒng)的可打開文件句柄:
[root@www ~]# ulimit -n
1024

二 :CentOS7修改單個(gè)進(jìn)程可打開的最大文件句柄數(shù)?

2.1./etc/security/limits.conf中指定的nofile的值,nofile有上限,不是無窮大。nofile由內(nèi)核參數(shù)nr_open定義的. “在2.6.25內(nèi)核之前有個(gè)宏定義,定義了這個(gè)值的最大值,為1024*1024,正好是100萬,而在2.6.25內(nèi)核及其之后,這個(gè)值是可以通過/proc/sys/fs/nr_open來設(shè)置?!?/h4>

2.2.使用cat /proc/sys/fs/nr_open 查看nr_open值,可通過修改/etc/sysctl.conf 修改fs.nr_open值,sysctl -p生效

2.3.fix_max linux內(nèi)核定義的最大file handles(文件句柄數(shù)).nr_open定義是單進(jìn)程最大file-handles,file-handles(即文件句柄) file-max: The value in file-max denotes the maximum number of file- handles that the Linux kernel will allocate. When you get lots of error messages about running out of file handles, you might want to increase this limit

nr_open:
This denotes the maximum number of file-handles a process can
allocate. Default value is 1024*1024 (1048576) which should be
enough for most machines. Actual limit depends on RLIMIT_NOFILE
resource limit.

注:
在centos 5/6 等版本中,資源限制的配置可以在 /etc/security/limits.conf 設(shè)置,針對(duì)root/user等各個(gè)用戶或者*代表所有用戶來設(shè)置。 當(dāng)然,/etc/security/limits.d/ 中可以配置,系統(tǒng)是先加載limits.conf然后按照英文字母順序加載limits.d目錄下的配置文件,后加載配置覆蓋之前的配置。

不過,在CentOS 7 / RHEL 7的系統(tǒng)中,使用Systemd替代了之前的SysV,因此 /etc/security/limits.conf 文件的配置作用域縮小了一些。limits.conf這里的配置,只適用于通過PAM認(rèn)證登錄用戶的資源限制,它對(duì)systemd的service的資源限制不生效。登錄用戶的限制,與上面講的一樣,通過 /etc/security/limits.conf 和 limits.d 來配置即可。
對(duì)于systemd service的資源限制,如何配置呢?

全局的配置,放在文件 /etc/systemd/system.conf 和 /etc/systemd/user.conf。 同時(shí),也會(huì)加載兩個(gè)對(duì)應(yīng)的目錄中的所有.conf文件 /etc/systemd/system.conf.d/*.conf 和 /etc/systemd/user.conf.d/*.conf
其中,system.conf 是系統(tǒng)實(shí)例使用的,user.conf用戶實(shí)例使用的。一般的sevice,使用system.conf中的配置即可。systemd.conf.d/*.conf中配置會(huì)覆蓋system.conf。

注意:修改了system.conf后,需要重啟系統(tǒng)才會(huì)生效。

2.4、如果需要修改 單個(gè)進(jìn)程打開的文件句柄數(shù) 即nofile大于1024*1024,需要修改nr_open,方法如下:
1、使用cat /proc/sys/fs/nr_open查看nr_open值;
[root@localhost ~]# cat /proc/sys/fs/nr_open?
1048576
2、修改nr_open的值為10240000
打開/etc/sysctl.conf,在文件末尾添加fs.nr_open=10240000

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).

fs.nr_open=10240000

保存
(注:nr_open的值要小于file—max)

2.3.1、執(zhí)行如下命令,使修改生效
sysctl -p
2.3.2、驗(yàn)證修改是否生效
cat /proc/sys/fs/nr_open
如果結(jié)果為10240000,說明修改生效
2.3.4、修改/etc/systemd/system.conf,主要用于systemd service的資源限制
[root@localhost ~]# vi /etc/systemd/system.conf
# ?This file is part of systemd.
#
# ?systemd is free software; you can redistribute it and/or modify it
# ?under the terms of the GNU Lesser General Public License as published by
# ?the Free Software Foundation; either version 2.1 of the License, or
# ?(at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See systemd-system.conf(5) for details.

[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#CrashShell=no
#ShowStatus=yes
#CrashChVT=1
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
#JoinControllers=cpu,cpuacct net_cls,net_prio
#RuntimeWatchdogSec=0
#ShutdownWatchdogSec=10min
#CapabilityBoundingSet=
#SystemCallArchitectures=
#TimerSlackNSec=
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultRestartSec=100ms
#DefaultStartLimitInterval=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=no
#DefaultTasksAccounting=no
#DefaultTasksMax=
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
DefaultLimitCORE=infinity
#DefaultLimitRSS=
#DefaultLimitNOFILE=
DefaultLimitNOFILE=10240000
#DefaultLimitAS=
#DefaultLimitNPROC=
DefaultLimitNPROC=10240000
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=

保存

2.3.5、修改/etc/security/limits.conf文件
[root@localhost ~]# vi /etc/security/limits.conf
在文件末尾添加
root ? ? ? ? ? ?soft ? ?fsize ? ? ? ? ? unlimited
root ? ? ? ? ? ?hard ? ?fsize ? ? ? ? ? unlimited
root ? ? ? ? ? ?soft ? ?cpu ? ? ? ? ? ? unlimited
root ? ? ? ? ? ?hard ? ?cpu ? ? ? ? ? ? unlimited
root ? ? ? ? ? ?soft ? ?as ? ? ? ? ? ? ?unlimited
root ? ? ? ? ? ?hard ? ?as ? ? ? ? ? ? ?unlimited
root ? ? ? ? ? ?soft ? ?nofile ? ? ? ? ?10240000
root ? ? ? ? ? ?hard ? ?nofile ? ? ? ? ?10240000
root ? ? ? ? ? ?soft ? ?nproc ? ? ? ? ? 10240000
root ? ? ? ? ? ?hard ? ?nproc ? ? ? ? ? 10240000

保存退出

2.3.6、修改/etc/security/limits.d/20-nproc.conf文件
[root@localhost ~]# vi /etc/security/limits.d/20-nproc.conf?
修改
* ? ? ? ? ?soft ? ?nproc ? ? 4096

* ? ? ? ? ?soft ? ?nproc ? ? 10240000

保存。
CentOS7修改單個(gè)進(jìn)程可打開的最大文件句柄數(shù)為10240000完成。














后續(xù)完善一主二從的搭建:.........................................................................................................


?文章來源地址http://www.zghlxwxcb.cn/news/detail-649812.html














到了這里,關(guān)于MySQL8.xx一主兩從復(fù)制安裝與配置的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Kubernetes(k8s)上搭建一主兩從的mysql8集群

    Kubernetes(k8s)上搭建一主兩從的mysql8集群

    本文章視頻教程地址:https://www.bilibili.com/video/BV1iw411e7ZE/ 首先你需要準(zhǔn)備一個(gè)kubernetes集群和一臺(tái)nfs服務(wù)器,為了方便,我就用 k8s-master 來做nfs服務(wù)器了。我的服務(wù)器IP地址和用途如圖: IP地址 主機(jī)名 用途 192.168.1.160 k8s-master Kubernetes主服務(wù)器兼nfs服務(wù)器 192.168.1.161 K8s-node01 Ku

    2024年02月06日
    瀏覽(33)
  • 使用Docker搭建一個(gè)“一主兩從”的 Redis 集群(超詳細(xì)步驟)

    使用Docker搭建一個(gè)“一主兩從”的 Redis 集群(超詳細(xì)步驟)

    1、Redis 單機(jī)版安裝 1.1 拉取 Redis 首先從 docker hub 拉取 Redis 鏡像,這里拉取 7.0 版。 1.2 創(chuàng)建數(shù)據(jù)卷目錄 首先要在宿主機(jī)/root 目錄中創(chuàng)建一個(gè)目錄 redis,將來用于存放外掛文件 redis.conf。 使用rz命令上傳一份redis.conf: 1.3 修改 redis.conf 修改配置文件: 1.解除 IP 綁定 將 bind 行注釋

    2024年02月21日
    瀏覽(29)
  • CentOS 7.9 環(huán)境下搭建k8s集群(一主兩從)

    CentOS 7.9 環(huán)境下搭建k8s集群(一主兩從)

    目錄 一、硬件準(zhǔn)備(虛擬主機(jī)) 二、環(huán)境準(zhǔn)備 1、所有機(jī)器關(guān)閉防火墻 2、所有機(jī)器關(guān)閉selinux 3、所有機(jī)器關(guān)閉swap 4、所有機(jī)器上添加主機(jī)名與ip的對(duì)應(yīng)關(guān)系 5、在所有主機(jī)上將橋接的ipv4流量傳遞到iptables的鏈 三、為所有節(jié)點(diǎn)安裝docker 四、集群部署 1、為所有節(jié)點(diǎn)修改倉庫,

    2024年03月14日
    瀏覽(25)
  • Linux部署Redis哨兵集群 一主兩從三哨兵(這里使用Redis6,其它版本類似)

    Linux部署Redis哨兵集群 一主兩從三哨兵(這里使用Redis6,其它版本類似)

    ??????Redis-Sentinel是redis官方推薦的高可用性解決方案,sentinel哨兵是特殊的redis服務(wù),不提供讀寫服務(wù),主要用來監(jiān)控redis實(shí)例節(jié)點(diǎn),當(dāng)用redis作master-slave的高可用時(shí),如果master本身宕機(jī),redis本身或者客戶端都沒有實(shí)現(xiàn)主從切換的功能,而redis-sentinel就是一個(gè)獨(dú)立運(yùn)行的進(jìn)程

    2024年02月04日
    瀏覽(21)
  • 【云原生-K8s-1】kubeadm搭建k8s集群(一主兩從)完整教程及kubernetes簡(jiǎn)介

    【云原生-K8s-1】kubeadm搭建k8s集群(一主兩從)完整教程及kubernetes簡(jiǎn)介

    ?? 博主簡(jiǎn)介 ????云計(jì)算領(lǐng)域優(yōu)質(zhì)創(chuàng)作者 ????華為云開發(fā)者社區(qū)專家博主 ????阿里云開發(fā)者社區(qū)專家博主 ?? 交流社區(qū): 運(yùn)維交流社區(qū) 歡迎大家的加入! ??Kubernetes(簡(jiǎn)稱:k8s) 是Google在2014年6月開源的一個(gè)容器集群管理系統(tǒng),使用Go語言開發(fā),用于管理云平臺(tái)中多

    2024年02月07日
    瀏覽(28)
  • Docker搭建MySQL8.0主從復(fù)制(一主一從)

    Docker搭建MySQL8.0主從復(fù)制(一主一從)

    宿主機(jī)使用的版本為 19045 的win10專業(yè)版,MySQL使用的是8.0+,Docker容器使用Linux。 略 修改Docker默認(rèn)安裝路徑 安裝包自己就提供了修改安裝路徑的功能,CMD中運(yùn)行: “Docker Desktop Installer.exe” install --installation-dir= --installation-dir=path : changes the default installation location ( C:Program Fil

    2024年01月25日
    瀏覽(54)
  • CentOS7安裝Mysql8并進(jìn)行主從復(fù)制配置

    CentOS7安裝Mysql8并進(jìn)行主從復(fù)制配置

    CentOS7中安裝Mysql8并配置遠(yuǎn)程連接和修改密碼等: CentOS7中安裝Mysql8并配置遠(yuǎn)程連接和修改密碼等_霸道流氓氣質(zhì)的博客-CSDN博客 在上面實(shí)現(xiàn)安裝Mysql8的基礎(chǔ)上,克隆出兩臺(tái)機(jī)器,修改ip后進(jìn)行mysql的主從復(fù)制搭建。 在主庫上把數(shù)據(jù)更改記錄到二進(jìn)制日志中(Binary Log)中,這些記

    2024年02月16日
    瀏覽(26)
  • MySQL8.0.33主從復(fù)制配置記錄

    MySQL8.0.33主從復(fù)制配置記錄

    官網(wǎng):https://dev.mysql.com/downloads/mysql/ 在線下載或者下載到本地再上傳 準(zhǔn)備wget下載工具: 進(jìn)入MySQL的bin目錄 初始化并得到密碼 ./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory 報(bào)錯(cuò),缺依賴:::: yum install -y libaio yum -y install numactl 再初始

    2024年02月02日
    瀏覽(25)
  • mysql主從復(fù)制搭建(一主一從)

    mysql主從復(fù)制搭建(一主一從)

    提示:文章寫完后,目錄可以自動(dòng)生成,如何生成可參考右邊的幫助文檔 介紹 MySQL主從復(fù)制是一個(gè)異步的復(fù)制過程,底層是基于Mysql數(shù)據(jù)庫自帶的二進(jìn)制日志功能。就是一臺(tái)或多臺(tái)MySQL數(shù)據(jù)庫(slave,即從庫)從另一臺(tái)MySQL數(shù)據(jù)庫(master,即主庫)進(jìn)行日志的復(fù)制然后解析日志

    2024年02月12日
    瀏覽(13)
  • Mysql8安裝教程與配置

    Mysql8安裝教程與配置

    ? ? ? ? ? ? ? ? ? ? ? ? 添加密碼? ? ? ?出現(xiàn)報(bào)錯(cuò) MySQL error 1042: Unable to connect to any of the specified MySQL hosts. Failed to connect to MySQL Server 8.0.23 after 10 attempts. Ended configuration step: Starting the server 使用Win+R -- 運(yùn)行 “services.msc” -- 打開service服務(wù)管理器,找到剛才安裝mysql的服務(wù)名稱

    2024年02月13日
    瀏覽(26)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包