Created
March 14, 2017 22:14
-
-
Save eon01/9bb0ad98fbfc2e9cf53df1c363078465 to your computer and use it in GitHub Desktop.
Installing MariaDB for OpenStack (Clone from: OpenStack Cloud Computing Cookbook)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # controller.sh | |
| # Authors: Kevin Jackson ([email protected]) | |
| # Cody Bunch ([email protected]) | |
| # Egle Sigler ([email protected]) | |
| # Vagrant scripts used by the OpenStack Cloud Computing Cookbook, 3rd Edition | |
| # Website: http://www.openstackcookbook.com/ | |
| # Scripts updated for Juno | |
| # The routeable IP of the node is on our eth1 interface | |
| ETH1_IP=$(ifconfig eth1 | awk '/inet addr/ {split ($2,A,":"); print A[2]}') | |
| ETH2_IP=$(ifconfig eth2 | awk '/inet addr/ {split ($2,A,":"); print A[2]}') | |
| ETH3_IP=$(ifconfig eth3 | awk '/inet addr/ {split ($2,A,":"); print A[2]}') | |
| PUBLIC_IP=${ETH3_IP} | |
| INT_IP=${ETH1_IP} | |
| ADMIN_IP=${ETH3_IP} | |
| #export LANG=C | |
| # MySQL | |
| export MYSQL_HOST=${ETH1_IP} | |
| export MYSQL_ROOT_PASS=openstack | |
| export MYSQL_DB_PASS=openstack | |
| echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASS" | sudo debconf-set-selections | |
| echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASS" | sudo debconf-set-selections | |
| echo "mysql-server-5.5 mysql-server/root_password seen true" | sudo debconf-set-selections | |
| echo "mysql-server-5.5 mysql-server/root_password_again seen true" | sudo debconf-set-selections | |
| sudo apt-get -y install mariadb-server python-mysqldb | |
| sudo sed -i "s/^bind\-address.*/bind-address = 0.0.0.0/g" /etc/mysql/my.cnf | |
| sudo sed -i "s/^#max_connections.*/max_connections = 512/g" /etc/mysql/my.cnf | |
| # Skip Name Resolve | |
| echo "[mysqld] | |
| skip-name-resolve" > /etc/mysql/conf.d/skip-name-resolve.cnf | |
| # UTF-8 Stuff | |
| echo "[mysqld] | |
| collation-server = utf8_general_ci | |
| init-connect='SET NAMES utf8' | |
| character-set-server = utf8" > /etc/mysql/conf.d/01-utf8.cnf | |
| sudo service mysql restart | |
| # Ensure root can do its job | |
| mysql -u root -p${MYSQL_ROOT_PASS} -h localhost -e "GRANT ALL ON *.* to root@\"localhost\" IDENTIFIED BY \"${MYSQL_ROOT_PASS}\" WITH GRANT OPTION;" | |
| mysql -u root -p${MYSQL_ROOT_PASS} -h localhost -e "GRANT ALL ON *.* to root@\"${MYSQL_HOST}\" IDENTIFIED BY \"${MYSQL_ROOT_PASS}\" WITH GRANT OPTION;" | |
| mysql -u root -p${MYSQL_ROOT_PASS} -h localhost -e "GRANT ALL ON *.* to root@\"%\" IDENTIFIED BY \"${MYSQL_ROOT_PASS}\" WITH GRANT OPTION;" | |
| mysqladmin -uroot -p${MYSQL_ROOT_PASS} flush-privileges |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment