Skip to content

Commit

Permalink
elefante-borneu (#45), mariadb-cluster (#46): testes e configurações …
Browse files Browse the repository at this point in the history
…com galera cluster, porém ainda não implementado; desligado yul-02 e yul-03 até situação estar resolvida, para evitar brain split mesmo que seja nessa fase de testes iniciais
  • Loading branch information
fititnt committed May 26, 2019
1 parent b031805 commit e7f2916
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 34 deletions.
46 changes: 43 additions & 3 deletions logbook/elefante-borneu-yul-01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,46 @@ mysql -u root -p
## AVISO: neste momento os servidores ainda NÃO estão em cluster. Por isso
## estamos tratando cada um individualmente.

vim /etc/mysql/my.cnf
# Edite 'bind-address = 0.0.0.0' em vez de 127.0.0.1. Não é o ideal, ainda mais
# que o firewall não esta ativado, porém é aceitavel neste momento
sudo vim /etc/mysql/my.cnf
# Edite o arquivo acima conforme:
# @see http://galeracluster.com/documentation-webpages/configuration.html

sudo vim /etc/mysql/mariadb.conf.d/galera.cnf
# Edite o arquivo acima conforme:
# @see http://galeracluster.com/documentation-webpages/dbconfiguration.html

# Vamos desligar o MariaDB. Quando forem ligados, serão parte de um Cluster
# Master-Master :,)
sudo systemctl stop mysql

#------------------------------------------------------------------------------#
# SEÇÃO 3: INICIALIZAÇÃO DE UM NOVO CLUSTER #
# TL;DR: Eu pessoalmente acho isso lindo. Não é o tipo de coisa que a gente #
# faz com frequência. (fititnt, 2019-05-26 19:18 BRT) #
#------------------------------------------------------------------------------#
## @see http://galeracluster.com/documentation-webpages/startingcluster.html#starting-the-first-cluster-node
## @see https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/#systemd-and-bootstrapping
## @see http://man7.org/linux/man-pages/man1/galera_new_cluster.1.html

## NOTA IMPORTANTE: isto será feito apenas no elefante-borneu-yul-01.etica.ai

### ALERTA: NÃO EXECUTE ESTE COMANDO NOS DEMAIS NÓS! ISTO OCORRE APENAS UMA VEZ
### DURANTE A CRIAÇÃO DE UM CLUSTER DO ZERO!
sudo galera_new_cluster

# Nos demais nós, execute
## sudo systemctl start mysql

# sudo systemctl start mysql --wsrep-new-cluster
## resposta: systemctl: unrecognized option '--wsrep-new-cluster'
# sudo /usr/bin/mysqld_bootstrap
## resposta: sudo: /usr/bin/mysqld_bootstrap: command not found
## O comando acima falha

## @TODO rever configuração em YUL-01, o cluster ainda não está ok para inicializar.
# Vide http://galeracluster.com/documentation-webpages/configuration.html
# (fititnt, 2019-05-26 20:08 BRT)


## @todo Rocha deve migrar parte do conteudo de https://docs.google.com/document/d/1ZQsLgTPJUKQsqyoWbhAOYOXVaKWvo7oAhi91BbBVy9E/edit
# para estes diarios de bordo (fititnt, 2019-05-26 19:38 BRT)
19 changes: 19 additions & 0 deletions logbook/elefante-borneu-yul-01/etc/mysql/mariadb.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf

[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8

[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server = utf8
collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# FILE: /etc/mysql/mariadb.conf.d/galera.cnf
# SERVER: elefante-borneu-yul-01.etica.ai

[mysqld]
wsrep_cluster_name=ElefanteBorneu
wsrep_cluster_address="gcomm://149.56.130.19, 149.56.130.66, 149.56.130.178"
wsrep_node_name=YUL-01
wsrep_node_address="149.56.130.19"
26 changes: 17 additions & 9 deletions logbook/elefante-borneu-yul-01/etc/mysql/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking

# Resolve erros como
## > May 26 22:44:33 elefante-borneu-yul-01 mysqld[7399]: 2019-05-26 22:44:33 392 [Warning] IP address '192.99.247.117' has been resolved to the host name '117.ip-192-99-247.net', which resembles IPv4-address itself.
# E impede alguns tipos de ataques
skip-host-cache
skip-name-resolve

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
# TODO: restringir coneccoes apenas a IPs especificos antes do periodo de uso efetivo (fititnt, 2019-05-26 18:27 BRT)
# bind-address = 127.0.0.1
## Linha acima comentada, conforme recomendação de http://galeracluster.com/documentation-webpages/configuration.html

#
# * Fine Tuning
Expand Down Expand Up @@ -158,20 +165,21 @@ innodb_flush_method = O_DIRECT
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
wsrep_on=ON
wsrep_provider=/usr/lib/libgalera_smm.so
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_sst_method=rsync
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
innodb_flush_log_at_trx_commit=0

[mysqldump]
quick
Expand Down
30 changes: 27 additions & 3 deletions logbook/elefante-borneu-yul-02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,30 @@ mysql -u root -p
## AVISO: neste momento os servidores ainda NÃO estão em cluster. Por isso
## estamos tratando cada um individualmente.

vim /etc/mysql/my.cnf
# Edite 'bind-address = 0.0.0.0' em vez de 127.0.0.1. Não é o ideal, ainda mais
# que o firewall não esta ativado, porém é aceitavel neste momento
sudo vim /etc/mysql/my.cnf
# Edite o arquivo acima conforme:
# @see http://galeracluster.com/documentation-webpages/configuration.html

sudo vim /etc/mysql/mariadb.conf.d/galera.cnf
# Edite o arquivo acima conforme:
# @see http://galeracluster.com/documentation-webpages/dbconfiguration.html

# Vamos desligar o MariaDB. Quando forem ligados, serão parte de um Cluster
# Master-Master :,)
sudo systemctl stop mysql

#------------------------------------------------------------------------------#
# SEÇÃO 3: INICIALIZAÇÃO DE UM NOVO CLUSTER #
# TL;DR: Eu pessoalmente acho isso lindo. Não é o tipo de coisa que a gente #
# faz com frequência. (fititnt, 2019-05-26 19:18 BRT) #
#------------------------------------------------------------------------------#
## @see http://galeracluster.com/documentation-webpages/startingcluster.html#starting-the-first-cluster-node

## NOTA IMPORTANTE: isto será feito apenas no elefante-borneu-yul-01.etica.ai

## @TODO rever configuração em YUL-01, o cluster ainda não está ok para inicializar.
# Vide http://galeracluster.com/documentation-webpages/configuration.html
# (fititnt, 2019-05-26 20:08 BRT)

# O comando a seguir mantem YUL-02 e YUL-03 desligadas até o cluster estar iniciado
sudo systemctl stop mysql
19 changes: 19 additions & 0 deletions logbook/elefante-borneu-yul-02/etc/mysql/mariadb.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf

[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8

[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server = utf8
collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# FILE: /etc/mysql/mariadb.conf.d/galera.cnf
# SERVER: elefante-borneu-yul-02.etica.ai

[mysqld]
wsrep_cluster_name=ElefanteBorneu
wsrep_cluster_address="gcomm://149.56.130.19, 149.56.130.66, 149.56.130.178"
wsrep_node_name=YUL-02
wsrep_node_address="149.56.130.66"
22 changes: 14 additions & 8 deletions logbook/elefante-borneu-yul-02/etc/mysql/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking

# Resolve erros como
## > May 26 22:44:33 elefante-borneu-yul-01 mysqld[7399]: 2019-05-26 22:44:33 392 [Warning] IP address '192.99.247.117' has been resolved to the host name '117.ip-192-99-247.net', which resembles IPv4-address itself.
# E impede alguns tipos de ataques
skip-host-cache
skip-name-resolve

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0

# TODO: restringir coneccoes apenas a IPs especificos antes do periodo de uso efetivo (fititnt, 2019-05-26 18:27 BRT)
# bind-address = 127.0.0.1
## Linha acima comentada, conforme recomendação de http://galeracluster.com/documentation-webpages/configuration.html

#
# * Fine Tuning
Expand Down Expand Up @@ -162,17 +168,17 @@ innodb_flush_method = O_DIRECT
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
innodb_flush_log_at_trx_commit=0

[mysqldump]
quick
Expand Down
29 changes: 26 additions & 3 deletions logbook/elefante-borneu-yul-03.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,30 @@ mysql -u root -p
## AVISO: neste momento os servidores ainda NÃO estão em cluster. Por isso
## estamos tratando cada um individualmente.

vim /etc/mysql/my.cnf
# Edite 'bind-address = 0.0.0.0' em vez de 127.0.0.1. Não é o ideal, ainda mais
# que o firewall não esta ativado, porém é aceitavel neste momento
sudo vim /etc/mysql/my.cnf
# Edite o arquivo acima conforme:
# @see http://galeracluster.com/documentation-webpages/configuration.html

sudo vim /etc/mysql/mariadb.conf.d/galera.cnf
# Edite o arquivo acima conforme:
# @see http://galeracluster.com/documentation-webpages/dbconfiguration.html

# Vamos desligar o MariaDB. Quando forem ligados, serão parte de um Cluster
# Master-Master :,)
sudo systemctl stop mysql

#------------------------------------------------------------------------------#
# SEÇÃO 3: INICIALIZAÇÃO DE UM NOVO CLUSTER #
# TL;DR: Eu pessoalmente acho isso lindo. Não é o tipo de coisa que a gente #
# faz com frequência. (fititnt, 2019-05-26 19:18 BRT) #
#------------------------------------------------------------------------------#
## @see http://galeracluster.com/documentation-webpages/startingcluster.html#starting-the-first-cluster-node

## NOTA IMPORTANTE: isto será feito apenas no elefante-borneu-yul-01.etica.ai

## @TODO rever configuração em YUL-01, o cluster ainda não está ok para inicializar.
# Vide http://galeracluster.com/documentation-webpages/configuration.html
# (fititnt, 2019-05-26 20:08 BRT)

# O comando a seguir mantem YUL-02 e YUL-03 desligadas até o cluster estar iniciado
sudo systemctl stop mysql
19 changes: 19 additions & 0 deletions logbook/elefante-borneu-yul-03/etc/mysql/mariadb.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf

[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8

[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server = utf8
collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# FILE: /etc/mysql/mariadb.conf.d/galera.cnf
# SERVER: elefante-borneu-yul-03.etica.ai

[mysqld]
wsrep_cluster_name=ElefanteBorneu
wsrep_cluster_address="gcomm://149.56.130.19, 149.56.130.66, 149.56.130.178"
wsrep_node_name=YUL-03
wsrep_node_address="149.56.130.178"
24 changes: 16 additions & 8 deletions logbook/elefante-borneu-yul-03/etc/mysql/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@ tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking

# Resolve erros como
## > May 26 22:44:33 elefante-borneu-yul-01 mysqld[7399]: 2019-05-26 22:44:33 392 [Warning] IP address '192.99.247.117' has been resolved to the host name '117.ip-192-99-247.net', which resembles IPv4-address itself.
# E impede alguns tipos de ataques
skip-host-cache
skip-name-resolve

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
# TODO: restringir coneccoes apenas a IPs especificos antes do periodo de uso efetivo (fititnt, 2019-05-26 18:27 BRT)
# bind-address = 127.0.0.1
## Linha acima comentada, conforme recomendação de http://galeracluster.com/documentation-webpages/configuration.html

#
# * Fine Tuning
#
Expand Down Expand Up @@ -160,17 +168,17 @@ innodb_flush_method = O_DIRECT
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
innodb_flush_log_at_trx_commit=0

[mysqldump]
quick
Expand All @@ -188,4 +196,4 @@ key_buffer = 16M
# The files must end with '.cnf', otherwise they'll be ignored.
#
!include /etc/mysql/mariadb.cnf
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/conf.d/

0 comments on commit e7f2916

Please sign in to comment.