MariaDB 10.1 Galera Cluster (Ubuntu)

Loading

作業系統平台為 Ubuntu 16.04 .安裝 MariaDB 10.1 (這版本 MariaDB server 含 Galera 功能).Ubuntu 16.04 透過 apt 安裝的 MariaDB 版本為 10 ,要額外安裝 10.1 需要自行設定 apt repository .

root@ubuntu:~# apt-get install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
software-properties-common is already the newest version (0.96.20.4).
software-properties-common set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
root@ubuntu:~# apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
Executing: /tmp/tmp.lX70odCgrA/gpg.1.sh --recv-keys
--keyserver
hkp://keyserver.ubuntu.com:80
0xF1656F24C74CD1D8
gpg: requesting key C74CD1D8 from hkp server keyserver.ubuntu.com
gpg: key C74CD1D8: public key "MariaDB Signing Key <signing-key@mariadb.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
root@ubuntu:~# add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial main'

上面為指令的方式,也可以透過修改 /etc/apt/sources.list 來新增 MariaDB 10.1

root@ubuntu:~#  /etc/apt/sources.list file.
# MariaDB 10.1 repository list - created 2016-10-01 06:54 UTC
# http://downloads.mariadb.org/mariadb/repositories/
deb [arch=amd64,i386] http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial main
deb-src http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial main

新增 apt repository 需要透過 apt update 更新.

root@ubuntu:~# apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease                     
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]    
Get:3 http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial InRelease [3,874 B]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]   
Get:5 http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial/main ppc64el Packages [5,581 B]
Get:6 http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial/main amd64 Packages [5,581 B]
Get:7 http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/ubuntu xenial/main i386 Packages [5,574 B]
Hit:8 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease           
Fetched 211 kB in 2s (78.5 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
79 packages can be upgraded. Run 'apt list --upgradable' to see them.

現在安裝的 MariaDB 可以看到是 10.1 版本的.

root@ubuntu:~# apt install mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  galera-3 gawk iproute libaio1 libdbd-mysql-perl libdbi-perl
  libhtml-template-perl libjemalloc1 libmariadbclient18 libmysqlclient18
  libmysqlclient20 libreadline5 libsigsegv2 mariadb-client-10.1
  mariadb-client-core-10.1 mariadb-common mariadb-server-10.1
  mariadb-server-core-10.1 mysql-common socat
Suggested packages:
  gawk-doc libmldbm-perl libnet-daemon-perl libsql-statement-perl
  libipc-sharedcache-perl libterm-readkey-perl mailx mariadb-test tinyca
The following NEW packages will be installed:
  galera-3 gawk iproute libaio1 libdbd-mysql-perl libdbi-perl
  libhtml-template-perl libjemalloc1 libmariadbclient18 libmysqlclient18
  libmysqlclient20 libreadline5 libsigsegv2 mariadb-client-10.1
  mariadb-client-core-10.1 mariadb-common mariadb-server mariadb-server-10.1
  mariadb-server-core-10.1 mysql-common socat
0 upgraded, 21 newly installed, 0 to remove and 79 not upgraded.
Need to get 23.7 MB of archives.
After this operation, 190 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
......

接下來我們可以

  1. MariaDB Galera Cluster Server 設定方式請參考 https://benjr.tw/95381
  2. MariaDB Galera Cluster + HAProxy 設定方式請參考 https://benjr.tw/95536
    連結文章的作業系統為 CentOS 跟 Ubuntu 大致類似, Ubuntu 需要在 /etc/default/haproxy 將 ENABLED 設定為 1

    root@ubuntu:~# /etc/default/haproxy
    ENABLED=1
    
沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料