Odroid MariaDB Galera Cluster

Moderators: odroid, mdrjr

Odroid MariaDB Galera Cluster

Unread postby moloth » Wed May 07, 2014 3:39 pm

Im setting up a MariaDB Galera Cluster for my work using the odroid. I use the script below to build from source:

Code: Select all
#!/bin/bash
#First download the 2 source files
#http://galeracluster.com/downloads/ - get  25.3.5
#https://downloads.mariadb.org/mariadb-galea/ - get 10.0.10
#If you want different versions check this out to make sure they are compatible
#https://mariadb.com/kb/en/galera/
#
#Start this script where you have downloaded your source files
#Edit the next two line to reflect your source names

MARIADB_SOURCE=mariadb-galera-10.0.10.tar.gz
GALERA_SOURCE=galera-25.3.5-src.tar.gz


if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root (sudo su)" 1>&2
   exit 1
fi

#Step through the script looking for errors
set -x
trap read debug

mkdir /opt/mariadb
mv $MARIADB_SOURCE /opt/mariadb

mkdir /opt/galera
mv $GALERA_SOURCE /opt/galera

apt-get update;
apt-get install build-essential pv

#--------------------
# Build Mariadb
#--------------------



cd /opt/mariadb
pv -pe $MARIADB_SOURCE | tar xzf -
rm latest
ln -sf mariadb-10.0.10 latest
mkdir /usr/local/mysql


mkdir /var/run/mysqld
groupadd mysql
useradd -d /usr/local/mysql -s /bin/false -g mysql mysql
chown mysql:mysql /usr/local/mysql 
chown mysql:root /var/run/mysqld

#get tools and headers for mariadb build
apt-get install cmake libncurses5-dev libssl-dev

cd /opt/mariadb/latest
cmake .
cmake --build .
make test
make install

chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

#install the "service mysql start"
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
update-rc.d mysql defaults


#---------------------------
# MariaDB Galera Config File
#---------------------------

mkdir /etc/mysql
IPADDR=$(ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
read -r -d '' VAR <<EOF
[mysqld]
#mysql settings
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
query_cache_size=0
query_cache_type=0
bind-address=0.0.0.0

#galera settings
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_name="my_wsrep_cluster"
#wsrep_cluster_address="gcomm://$IPADDR"
wsrep_cluster_address="gcomm://"
wsrep_sst_method=rsync
EOF
echo "$VAR" > /etc/mysql/galera.cnf;

chown -R mysql:mysql /usr/local/mysql

#Path will work after session logout
read -p "Update Environment Path with /usr/local/mysql/bin? (y/n)" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then   
echo "PATH=${PATH}:/usr/local/mysql/bin" > /etc/environment
fi


#---------------------------
# Install Galera
#---------------------------

cd /opt/galera
pv -pe $GALERA_SOURCE | tar xzf -
rm latest
ln -sf galera-25.3.5-src latest
cd /opt/galera/latest   
apt-get install libboost-all-dev scons check


scons
mkdir /usr/lib/galera
cp libgalera_smm.so /usr/lib/galera/



service mysql start


mysql -uroot -proot -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'
echo
echo "If all went well check cluster is good (it should be 1)"
echo
#echo “You can start with /usr/local/mysql/bin/mysqld_safe --datadir='/usr/local/mysql/data' --user='mysql' --basedir='/usr/local/mysql'”

read -p "Secure your mysql database? (y/n)" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then   
/usr/local/mysql/bin/mysql_secure_installation
fi


Ive also make a deb package to install on a fresh 13.10 Ubuntu install. Available here mariadb-galera_10.0.10-3_armhf.deb

Code: Select all
#installation for deb package
apt-get uninstall mysql-common
dpkg -i mariadb-galera_10.0.10-3_armhf.deb


if you need to modify the package use the following instructions:

Code: Select all
mkdir -p extract/DEBIAN
dpkg-deb -x package.deb extract/
dpkg-deb -e package.deb extract/DEBIAN
[...do something, e.g. edit the control file...]
mkdir build
dpkg-deb -b extract/ build/
moloth
 
Posts: 1
Joined: Thu May 01, 2014 6:37 pm
languages_spoken: english
ODROIDs: U3

Re: Odroid MariaDB Galera Cluster

Unread postby ealvaradoc » Thu May 04, 2017 7:03 am

HI!, i ran the script on a odroid c1+ with ubuntu 16.04 but after end it cannot find the 'libgalera_smm.so', it's not created. Do you have any idea?


Thanks


Enrique
ealvaradoc
 
Posts: 1
Joined: Sun Apr 23, 2017 8:28 am
languages_spoken: english
ODROIDs: c1+


Return to Projects

Who is online

Users browsing this forum: No registered users and 1 guest