<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ivaneeo's blog

    自由的力量,自由的生活。

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks

    Install MariaDB Galera Cluster in Ubuntu

    by  on 2 JULY 2013 · LEAVE A COMMENT

    I am going to show you on how to install MariaDB Cluster (with Galera) in Ubuntu Precise (12.04) LTS 64bit. You need at least 3 hosts running together to form a reliable cluster.

    Hosts list:

    maria1 – 192.168.10.101
    maria2 – 192.168.10.102
    maria3 – 192.168.10.103

     

    Prepare Hosts

    In all hosts, this is my /etc/hosts definition:

    192.168.10.101        maria1 maria1.mycluster.com 192.168.10.102        maria2 maria2.mycluster.com 192.168.10.103        maria3 maria3.mycluster.com

     

    Install MariaDB Cluster

    1. Install the GPG key required by apt:

    $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 1BB943DB

    2. Add the apt repository:

    $ sudo add-apt-repository 'deb http://mirror.stshosting.co.uk/mariadb/repo/5.5/ubuntu precise main'

    3. Get the latest repo:

    $ sudo apt-get update

    4. Install MariaDB Cluster and related packages:

    $ sudo apt-get install -y galera  mariadb-galera-server-5.5 mariadb-client-5.5 libmariadbclient18 mariadb-client-core-5.5 rsync netcat-openbsd

    ** Make sure you put the same MySQL root password on all hosts

     

    Install Percona Xtrabackup

    1. We are going to use Xtrabackup to perform State Snapshot Transfer (SST). Install GPG key for Percona:

    $ sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A

    2. Add the apt repository for Percona:

    $ sudo add-apt-repository 'deb http://repo.percona.com/apt precise  main'

    3. Update and install Percona Xtrabackup:

    $ sudo apt-get update && sudo apt-get -y install percona-toolkit percona-xtrabackup

     

    Configure MariaDB Cluster

    1. Once the installation completed, you need to comment following lines in /etc/mysql/my.cnf:

    #bind-address #default_storage_engine #query_cache_limit #query_cache_size

    2. Add following lines for wsrep configuration options in /etc/mysql/my.cnf under [mysqld] directive:

    binlog_format=ROW default_storage_engine=innodb innodb_autoinc_lock_mode=2 innodb_locks_unsafe_for_binlog=1 innodb_doublewrite=1

    3. Add following lines into specific node under [mysqld] directive:

    maria1:

    # wsrep provider configuration wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_provider_options="gcache.size=256M; gcache.page_size=128M" wsrep_cluster_address=gcomm:// wsrep_cluster_name="MariaDB_Cluster" wsrep_node_address="maria1" wsrep_node_name="maria1" wsrep_sst_method=xtrabackup wsrep_sst_auth="root:MyR00tPasswd" wsrep_node_incoming_address=192.168.10.101 wsrep_sst_receive_address=192.168.10.101 wsrep_slave_threads=16

    maria2:

    # wsrep provider configuration wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_provider_options="gcache.size=256M; gcache.page_size=128M" wsrep_cluster_address=gcomm://maria1 wsrep_cluster_name="MariaDB_Cluster" wsrep_node_address="maria2" wsrep_node_name="maria2" wsrep_sst_method=xtrabackup wsrep_sst_auth="root:MyR00tPasswd" wsrep_node_incoming_address=192.168.10.102 wsrep_sst_receive_address=192.168.10.102 wsrep_slave_threads=16

    maria3:

    # wsrep provider configuration wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_provider_options="gcache.size=256M; gcache.page_size=128M" wsrep_cluster_address=gcomm://maria1 wsrep_cluster_name="MariaDB_Cluster" wsrep_node_address="maria3" wsrep_node_name="maria3" wsrep_sst_method=xtrabackup wsrep_sst_auth="root:MyR00tPasswd" wsrep_node_incoming_address=192.168.10.103 wsrep_sst_receive_address=192.168.10.103 wsrep_slave_threads=16

     

    Initialize the Cluster

    1. Login to maria1 to initialize the cluster by restarting the service:

    $ sudo service mysql restart

    2. Login to maria2 and maria3 and restart MySQL. This will allow maria2 and maria3 to perform SST from maria1:

    $ sudo service mysql restart

    3. Login to MariaDB console and check for following values:

    MariaDB [(none)]> show status like 'wsrep_%';

    And you should see following output:

    | wsrep_local_state | 4 | | wsrep_local_state_comment | Synced | | wsrep_incoming_addresses | 192.168.10.101:3306,192.168.10.102:3306,192.168.10.103:3306 | | wsrep_cluster_size | 3 | | wsrep_ready | ON |

    You could now point your web server or application server to one of MariaDB cluster node to query.

     

    posted on 2014-03-02 00:26 ivaneeo 閱讀(527) 評論(0)  編輯  收藏 所屬分類: tip
    主站蜘蛛池模板: 亚洲精品人成网线在线播放va| 两个人www免费高清视频| 免费又黄又爽又猛的毛片| 国产福利免费视频| 亚洲精品在线免费观看视频| 噜噜嘿在线视频免费观看| 一个人看的免费视频www在线高清动漫| 久久久久久亚洲av成人无码国产| 国产片AV片永久免费观看| 免费无码午夜福利片69| 亚洲综合激情九月婷婷 | 在线看片人成视频免费无遮挡| 日韩大片免费观看视频播放 | 黑人粗长大战亚洲女2021国产精品成人免费视频 | 亚洲AV无码成人精品区狼人影院| 久久久青草青青国产亚洲免观| 日本h在线精品免费观看| 一级毛片a免费播放王色电影 | 亚洲经典在线中文字幕| 午夜亚洲福利在线老司机| 最近最新高清免费中文字幕 | 国产在线观看无码免费视频| 精品国产日韩久久亚洲| 亚洲av永久无码精品古装片| 欧洲精品免费一区二区三区| 久草视频在线免费看| 免费国产黄网站在线观看动图| 亚洲国产精品综合久久2007| 亚洲精品国产品国语在线| 日本牲交大片免费观看| 最近最新高清免费中文字幕| 中文字幕不卡免费视频| 看全免费的一级毛片| 亚洲中文字幕一二三四区| 久久亚洲AV成人无码国产| 久久久久亚洲精品无码网址 | 亚洲色图.com| 国产V亚洲V天堂无码| 久久精品国产精品亚洲艾草网美妙 | 免费观看无遮挡www的视频| 光棍天堂免费手机观看在线观看 |