summaryrefslogtreecommitdiffstats
path: root/compass/deploy/ansible/roles/ha/templates
diff options
context:
space:
mode:
Diffstat (limited to 'compass/deploy/ansible/roles/ha/templates')
-rw-r--r--compass/deploy/ansible/roles/ha/templates/failover.j265
-rw-r--r--compass/deploy/ansible/roles/ha/templates/haproxy.cfg133
-rw-r--r--compass/deploy/ansible/roles/ha/templates/keepalived.conf42
3 files changed, 0 insertions, 240 deletions
diff --git a/compass/deploy/ansible/roles/ha/templates/failover.j2 b/compass/deploy/ansible/roles/ha/templates/failover.j2
deleted file mode 100644
index b03c737..0000000
--- a/compass/deploy/ansible/roles/ha/templates/failover.j2
+++ /dev/null
@@ -1,65 +0,0 @@
-import ConfigParser, os, socket
-import logging as LOG
-import pxssh
-import sys
-import re
-
-LOG_FILE="/var/log/mysql_failover"
-try:
- os.remove(LOG_FILE)
-except:
- pass
-
-LOG.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', filename=LOG_FILE,level=LOG.DEBUG)
-ha_vip = {{ HA_VIP }}
-LOG.info("ha_vip: %s" % ha_vip)
-
-#ha_vip = "10.1.0.50"
-galera_path = '/etc/mysql/conf.d/wsrep.cnf'
-pattern = re.compile(r"gcomm://(?P<prev_ip>.*)")
-
-def ssh_get_hostname(ip):
- try:
- s = pxssh.pxssh()
- s.login("%s" % ip, "root", "root")
- s.sendline('hostname') # run a command
- s.prompt() # match the prompt
- result = s.before.strip() # print everything before the prompt.
- return result.split(os.linesep)[1]
- except pxssh.ExceptionPxssh as e:
- LOG.error("pxssh failed on login.")
- raise
-
-def failover(mode):
- config = ConfigParser.ConfigParser()
- config.optionxform = str
- config.readfp(open(galera_path))
- wsrep_cluster_address = config.get("mysqld", "wsrep_cluster_address")
- wsrep_cluster_address = pattern.match(wsrep_cluster_address).groupdict()["prev_ip"]
-
- LOG.info("old wsrep_cluster_address = %s" % wsrep_cluster_address)
-
- if mode == "master":
- # refresh wsrep_cluster_address to null
- LOG.info("I'm being master, set wsrep_cluster_address to null")
- wsrep_cluster_address = ""
-
- elif mode == "backup":
- # refresh wsrep_cluster_address to master int ip
- hostname = ssh_get_hostname(ha_vip)
- wsrep_cluster_address = socket.gethostbyname(hostname)
- LOG.info("I'm being slave, set wsrep_cluster_address to master internal ip")
-
- LOG.info("new wsrep_cluster_address = %s" % wsrep_cluster_address)
- wsrep_cluster_address = "gcomm://%s" % wsrep_cluster_address
- config.set("mysqld", "wsrep_cluster_address", wsrep_cluster_address)
- with open(galera_path, 'wb') as fp:
- #config.write(sys.stdout)
- config.write(fp)
-
- os.system("service mysql restart")
- LOG.info("failover success!!!")
-
-if __name__ == "__main__":
- LOG.debug("call me: %s" % sys.argv)
- failover(sys.argv[1])
diff --git a/compass/deploy/ansible/roles/ha/templates/haproxy.cfg b/compass/deploy/ansible/roles/ha/templates/haproxy.cfg
deleted file mode 100644
index 4ed528a..0000000
--- a/compass/deploy/ansible/roles/ha/templates/haproxy.cfg
+++ /dev/null
@@ -1,133 +0,0 @@
-
-global
- #chroot /var/run/haproxy
- daemon
- user haproxy
- group haproxy
- maxconn 4000
- pidfile /var/run/haproxy/haproxy.pid
- #log 127.0.0.1 local0
- tune.bufsize 1000000
- stats socket /var/run/haproxy.sock
- stats timeout 2m
-
-defaults
- log global
- maxconn 8000
- option redispatch
- option dontlognull
- option splice-auto
- timeout http-request 10s
- timeout queue 1m
- timeout connect 10s
- timeout client 6m
- timeout server 6m
- timeout check 10s
- retries 5
-
-listen proxy-glance_registry_cluster
- bind {{ HA_VIP }}:9191
- option tcpka
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:9191 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-glance_api_cluster
- bind {{ HA_VIP }}:9292
- option tcpka
- option httpchk
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:9292 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-nova-novncproxy
- bind {{ HA_VIP }}:6080
- option tcpka
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:6080 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-network
- bind {{ HA_VIP }}:9696
- option tcpka
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:9696 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-volume
- bind {{ HA_VIP }}:8776
- option tcpka
- option httpchk
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8776 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-keystone_admin_cluster
- bind {{ HA_VIP }}:35357
- option tcpka
- option httpchk
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:35357 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-keystone_public_internal_cluster
- bind {{ HA_VIP }}:5000
- option tcpka
- option httpchk
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:5000 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-nova_compute_api_cluster
- bind {{ HA_VIP }}:8774
- mode tcp
- option httpchk
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8774 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-nova_metadata_api_cluster
- bind {{ HA_VIP }}:8775
- option tcpka
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8775 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen proxy-cinder_api_cluster
- bind {{ HA_VIP }}:8776
- mode tcp
- option httpchk
- option tcplog
- balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8776 weight 1 check inter 2000 rise 2 fall 5
-{% endfor %}
-
-listen stats
- mode http
- bind 0.0.0.0:8888
- stats enable
- stats refresh 30s
- stats uri /
- stats realm Global\ statistics
- stats auth admin:admin
-
-
diff --git a/compass/deploy/ansible/roles/ha/templates/keepalived.conf b/compass/deploy/ansible/roles/ha/templates/keepalived.conf
deleted file mode 100644
index 0b49137..0000000
--- a/compass/deploy/ansible/roles/ha/templates/keepalived.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-global_defs {
-
- notification_email{
- root@huawei.com
- }
-
- notification_email_from keepalived@huawei.com
-
- smtp_server localhost
-
- smtp_connect_timeout 30
-
- router_id NodeA
-
-}
-
-vrrp_instance VI_1 {
-
- interface {{ INTERNAL_INTERFACE }}
- virtual_router_id 51
- state BACKUP
- nopreempt
- advert_int 1
-{% for host in groups['controller'] %}
-{% if host == inventory_hostname %}
- priority {{ 100 - loop.index0 * 5 }}
-{% endif %}
-{% endfor %}
-
- authentication {
- auth_type PASS
- auth_pass 1111
- }
-
- virtual_ipaddress {
- {{ HA_VIP }} dev {{ INTERNAL_INTERFACE }}
- }
-
- notify_master "/usr/local/bin/notify.sh master"
- notify_backup "/usr/local/bin/notify.sh backup"
-}
-