Skip to content

Instantly share code, notes, and snippets.

@agungsijawir
Created February 1, 2016 13:51
Show Gist options
  • Save agungsijawir/1b7ce453a40dd1b881fd to your computer and use it in GitHub Desktop.
Save agungsijawir/1b7ce453a40dd1b881fd to your computer and use it in GitHub Desktop.
Create MariaDB Galera Cluster

Create MariaDB Galera Cluster

For server hardware, each node requires at a minimum:

  • 1GHz single core CPU
  • 512MB RAM
  • 100 Mbps network connectivity
  • LinuxOS (Ubuntu 14.04 x64 preferred)

Installation

  1. Disable SELinux by typing sudo setenforce 0
  2. Add MariaDB to your server repository
    sudo apt-get install software-properties-common python-software-properties
    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
    sudo add-apt-repository 'deb deb http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu/ trusty main'
  3. Make sure your server accept incoming connection from TCP port 3306
    sudo iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
    sudo iptables-save
    
    OR
    ## The Linux kernel in Ubuntu provides a packet filtering system using netfilter, and the traditional interface for manipulating netfilter are the iptables suite of commands. But, it comes with easy to use ufw (Uncomplicated Firewall) tool. To open port 3306, enter:
    sudo ufw allow 3306
    ## only allow subnet 192.168.1.0/24 to connect to our mysql server ##
    sudo ufw allow from 192.168.1.0/24 to any port 3306
    
  4. Disabling AppArmor
    sudo ln -s /etc/apparmor.d/usr /etc/apparmor.d/disable/.sbin.mysqld
    sudo service apparmor restart
    
  5. Installing Galera Cluster
    apt-get install mariadb-client mariadb-galera-server galera
    
  6. Once you install mariadb server. Login to your mariadb-server by typing mysql -uroot -p<your_password>.
  7. Create new user and give new privileges.
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment