Skip to content

Instantly share code, notes, and snippets.

@nowelium
Created April 27, 2013 17:40
Show Gist options
  • Save nowelium/5473918 to your computer and use it in GitHub Desktop.
Save nowelium/5473918 to your computer and use it in GitHub Desktop.
Multiple mysqld server
shell > vagrant box add centos http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box
shell > vagrant init centos
shell > vi Vagrantfile
# Vagrantfile below: #1.Vagrantfile
shell > vagrant up
:
:
shell > vagrant ssh-config db1 >> $HOME/.ssh/config
shell > vagrant ssh-config db2 >> $HOME/.ssh/config
shell > vagrant ssh-config db3 >> $HOME/.ssh/config
shell > ssh db1
shell > mysql -u root -h 192.168.33.11 -e "show variables like 'hostname'"
shell > mysql -u root -h 192.168.33.12 -e "show variables like 'hostname'"
shell > mysql -u root -h 192.168.33.13 -e "show variables like 'hostname'"
Vagrant.configure("2") do |config|
config.vm.box = "centos"
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box"
[1, 2, 3].each do |node_num|
node = "db#{node_num}".to_sym
config.vm.define node do |node_config|
node_config.vm.hostname = node.to_s
node_config.vm.network :private_network, ip: "192.168.33.#{10 + node_num}"
node_config.vm.provision :shell, :inline => "sudo /sbin/chkconfig iptables off"
node_config.vm.provision :shell, :inline => "sudo /sbin/chkconfig ip6tables off"
node_config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id,"--memory", "256"]
end
end
end
end
shell > rpm -ivh MySQL-client-5.6.11-1.el6.x86_64.rpm MySQL-devel-5.6.11-1.el6.x86_64.rpm MySQL-server-5.6.11-1.el6.x86_64.rpm
[mysqld]
port = 3306
user = mysql
character-set-server = utf8
log-error = /var/log/mysqld.err
skip-name-resolve
innodb-file-per-table
[mysql]
default-character-set = utf8
show-warnings
shell > sudo cat /root/.mysql_secret
# remember root password
shell > mysql -u root -p
Enter password:
mysql > SET PASSWORD FOR root@localhost=PASSWORD('password');
mysql > exit
shell > sudo mysql_secure_installation
@nowelium
Copy link
Author

wget http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.12-2.el6.x86_64.rpm
wget http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.12-2.el6.x86_64.rpm
wget http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.12-2.el6.x86_64.rpm

@nowelium
Copy link
Author

sudo rpm -ivh MySQL-client-5.6.12-2.el6.x86_64.rpm MySQL-devel-5.6.12-2.el6.x86_64.rpm 
sudo rpm -ivh --force MySQL-server-5.6.12-2.el6.x86_64.rpm

@nowelium
Copy link
Author

[mysqld]
port = 3306
user = mysql
character-set-server = utf8
log-error = /var/log/mysqld.err
skip-name-resolve
innodb-file-per-table

server-id = 123
binlog-ignore-db = mysql
replicate-ignore-db = mysql

log-bin = /var/lib/mysql/mysqld-bin
relay-log = /var/lib/mysql/mysqld-relay-bin
log-slave-updates
expire_logs_days = 10

[mysql]
default-character-set = utf8
show-warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment