日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長提供免費收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

1 背景介紹

我們在數(shù)據(jù)庫運維的過程中.會遇到不同版本的數(shù)據(jù)庫部署需求.同時測試環(huán)境數(shù)據(jù)庫需求更是不同.有時為了節(jié)省資源.我們需要進行多實例的部署.或者在我們自己學(xué)習(xí)的過程中也需要進行多實例的部署..比如搭建各種MySQL的集群(mha,PXC,Xenon).這篇文章我將介紹多版本多實例的部署.

2 部署介紹

多版本多實例版本介紹:

下載對應(yīng)版本MySQL

2.1 軟件下載

下載地址:https://downloads.mysql.com/archives/community/

 

MySQL不同版本多實例部署

下載對應(yīng)版本MySQL二進制安裝包

2.2 解壓對應(yīng)軟件,并做軟鏈接

root@dba1 opt]# ll
-rw-r--r-- 1 root  root  304788904 Jul  3 21:50 mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz
-rw-r--r-- 1 root  root  661718255 Jul  3 21:52 mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz
-rw-r--r--  1 root root  347814208 Jul  4 02:17 mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz

解壓:
tar xf mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz 
tar xf mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz
tar xf mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz 

軟鏈接:
[root@db01 opt]# ln -s /opt/mysql-5.6.16-linux-glibc2.5-x86_64 /usr/local/mysql5616
[root@db01 opt]# ln -s /opt/mysql-5.7.33-linux-glibc2.12-x86_64 /usr/local/mysql5733
[root@db01 opt]# ln -s /opt/mysql-8.0.21-linux-glibc2.12-x86_64 /usr/local/mysql8021

2.3 創(chuàng)建對應(yīng)的數(shù)據(jù)目錄

mkdir /data/5616/data -p
mkdir /data/5733/data -p
mkdir /data/8021/data -p
[root@db01 opt]# ll /data/
total 0
drwxr-xr-x 3 root root 18 Jul  4 02:21 5616
drwxr-xr-x 3 root root 18 Jul  4 02:21 5733
drwxr-xr-x 3 root root 18 Jul  4 02:22 8021

2.4 對應(yīng)版本的配置文件準(zhǔn)備


[root@db01 var]# cat /data/5616/my.cnf 
[mysqld] ?
user=mysql
basedir=/usr/local/mysql5616
datadir=/data/5616/data
socket=/tmp/mysql5616.sock
server_id=56
port=3306


[root@db01 var]# cat /data/5733/my.cnf 
[mysqld]
user=mysql
basedir=/usr/local/mysql5733
datadir=/data/5733/data
socket=/tmp/mysql5733.sock
server_id=57
port=3307


[root@db01 var]# cat /data/8021/my.cnf 
[mysqld]
user=mysql
basedir=/usr/local/mysql8021
datadir=/data/8021/data
socket=/tmp/mysql8021.sock
server_id=80
port=3308


授權(quán)MySQL
[root@db01 opt]# chown -R mysql.mysql /data

3 初始化對應(yīng)版本的數(shù)據(jù)庫

在這里需要注意的是MySQL5.6版本的初始化方式和5.7 8.0初始化方式不同
MySQL5.6初始化是調(diào)用程序目錄下邊的mysql_install_db腳本進行初始化
首先初始化5.6版本數(shù)據(jù)庫
[root@db01 opt]# /usr/local/mysql5616/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5616 --datadir=/data/5616/data
Can't locate Data/Dumper.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/mysql5616/scripts/mysql_install_db line 42.
BEGIN failed--compilation aborted at /usr/local/mysql5616/scripts/mysql_install_db line 42.
出現(xiàn)這個初始化錯誤的時候代表缺少一個per的插件.執(zhí)行命令:
[root@db01 opt]# yum install 'perl(Data::Dumper)'
然后再進行初始化
[root@db01 opt]# /usr/local/mysql5616/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5616 --datadir=/data/5616/data
Installing MySQL system tables...2021-07-04 02:34:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-07-04 02:34:59 8251 [Note] InnoDB: Using atomics to ref count buffer pool pages
2021-07-04 02:34:59 8251 [Note] InnoDB: The InnoDB memory heap is disabled
2021-07-04 02:34:59 8251 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-07-04 02:34:59 8251 [Note] InnoDB: Compressed tables use zlib 1.2.3
2021-07-04 02:34:59 8251 [Note] InnoDB: Using Linux native AIO
2021-07-04 02:34:59 8251 [Note] InnoDB: Using CPU crc32 instructions
2021-07-04 02:34:59 8251 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2021-07-04 02:34:59 8251 [Note] InnoDB: Completed initialization of buffer pool
2021-07-04 02:34:59 8251 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2021-07-04 02:34:59 8251 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2021-07-04 02:34:59 8251 [Note] InnoDB: Database physically writes the file full: wait...
2021-07-04 02:34:59 8251 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2021-07-04 02:34:59 8251 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2021-07-04 02:34:59 8251 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2021-07-04 02:34:59 8251 [Warning] InnoDB: New log files created, LSN=45781
2021-07-04 02:34:59 8251 [Note] InnoDB: Doublewrite buffer not found: creating new
2021-07-04 02:34:59 8251 [Note] InnoDB: Doublewrite buffer created
2021-07-04 02:34:59 8251 [Note] InnoDB: 128 rollback segment(s) are active.
2021-07-04 02:34:59 8251 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-07-04 02:34:59 8251 [Note] InnoDB: Foreign key constraint system tables created
2021-07-04 02:34:59 8251 [Note] InnoDB: Creating tablespace and datafile system tables.
2021-07-04 02:34:59 8251 [Note] InnoDB: Tablespace and datafile system tables created.
2021-07-04 02:34:59 8251 [Note] InnoDB: Waiting for purge to start
2021-07-04 02:34:59 8251 [Note] InnoDB: 5.6.16 started; log sequence number 0
2021-07-04 02:35:00 8251 [Note] Binlog end
2021-07-04 02:35:00 8251 [Note] InnoDB: FTS optimize thread exiting.
2021-07-04 02:35:00 8251 [Note] InnoDB: Starting shutdown...
2021-07-04 02:35:01 8251 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2021-07-04 02:35:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-07-04 02:35:01 8274 [Note] InnoDB: Using atomics to ref count buffer pool pages
2021-07-04 02:35:01 8274 [Note] InnoDB: The InnoDB memory heap is disabled
2021-07-04 02:35:01 8274 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-07-04 02:35:01 8274 [Note] InnoDB: Compressed tables use zlib 1.2.3
2021-07-04 02:35:01 8274 [Note] InnoDB: Using Linux native AIO
2021-07-04 02:35:01 8274 [Note] InnoDB: Using CPU crc32 instructions
2021-07-04 02:35:01 8274 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2021-07-04 02:35:01 8274 [Note] InnoDB: Completed initialization of buffer pool
2021-07-04 02:35:01 8274 [Note] InnoDB: Highest supported file format is Barracuda.
2021-07-04 02:35:01 8274 [Note] InnoDB: 128 rollback segment(s) are active.
2021-07-04 02:35:01 8274 [Note] InnoDB: Waiting for purge to start
2021-07-04 02:35:01 8274 [Note] InnoDB: 5.6.16 started; log sequence number 1625977
2021-07-04 02:35:01 8274 [Note] Binlog end
2021-07-04 02:35:01 8274 [Note] InnoDB: FTS optimize thread exiting.
2021-07-04 02:35:01 8274 [Note] InnoDB: Starting shutdown...
2021-07-04 02:35:03 8274 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
當(dāng)看到上邊出現(xiàn)兩個OK的時候就代表初始化成功了

現(xiàn)在對MySQL5733進行初始化
[root@db01 opt]# /usr/local/mysql5733/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql5733 --datadir=/data/5733/data
2021-07-04T06:39:21.921546Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-07-04T06:39:22.547370Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-07-04T06:39:22.613516Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-07-04T06:39:22.672090Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9157d5c7-dc92-11eb-a479-000c29dfc6f4.
2021-07-04T06:39:22.675212Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-07-04T06:39:23.669684Z 0 [Warning] CA certificate ca.pem is self signed.
2021-07-04T06:39:24.018202Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
MySQL5733初始化成功

對MySQL8021進行初始化:
[root@db01 opt]# /usr/local/mysql8021/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql8021 --datadir=/data/8021/data
2021-07-04T06:41:09.105846Z 0 [System] [MY-013169] [Server] /usr/local/mysql8021/bin/mysqld (mysqld 8.0.21) initializing of server in progress as process 8326
2021-07-04T06:41:09.141094Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-04T06:41:11.039769Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-04T06:41:13.108039Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

3.2 啟動各版本數(shù)據(jù)庫

啟動MySQL5616
/usr/local/mysql5616/bin/mysqld_safe --defaults-file=/data/5616/my.cnf &
啟動MySQL5733
/usr/local/bin/mysqld_safe --defaults-file=/data/5733/my.cnf &
啟動MySQL8021
/usr/local/bin/mysqld_safe --defaults-file=/data/8021/my.cnf &
查看多實例啟動情況
[root@db01 mysql8021]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      6694/sshd           
tcp6       0      0 :::3306                 :::*                    LISTEN      11099/./bin/mysqld  
tcp6       0      0 :::3307                 :::*                    LISTEN      9767/mysqld         
tcp6       0      0 :::3308                 :::*                    LISTEN      11408/mysqld        
tcp6       0      0 :::22                   :::*                    LISTEN      6694/sshd           
tcp6       0      0 :::33060                :::*                    LISTEN      11408/mysqld        

3.3 啟動過程錯誤解決


[root@db01 opt]# /usr/local/mysql5733/bin/mysqld 
2021-07-04T06:50:33.162662Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-07-04T06:50:33.162787Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2021-07-04T06:50:33.162827Z 0 [Note] /usr/local/mysql5733/bin/mysqld (mysqld 5.7.33) starting as process 8912 ...
2021-07-04T06:50:33.162871Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2021-07-04T06:50:33.164529Z 0 [Warning] Can't create test file /usr/local/mysql/data/db01.lower-test
2021-07-04T06:50:33.164560Z 0 [Warning] Can't create test file /usr/local/mysql/data/db01.lower-test
2021-07-04T06:50:33.164596Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2021-07-04T06:50:33.164629Z 0 [ERROR] Aborting

2021-07-04T06:50:33.164662Z 0 [Note] Binlog end
2021-07-04T06:50:33.164732Z 0 [Note] 

這個錯誤是配置文件中有空格導(dǎo)致的.檢查是否有空格

分享到:
標(biāo)簽:MySQL
用戶無頭像

網(wǎng)友整理

注冊時間:

網(wǎng)站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨大挑戰(zhàn)2018-06-03

數(shù)獨一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運動步數(shù)有氧達(dá)人2018-06-03

記錄運動步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定