From 3e7d82a8f6527755c8eee5788235807dbb8a3df0 Mon Sep 17 00:00:00 2001 From: "carey.xu" Date: Mon, 14 Dec 2015 16:50:57 +0800 Subject: fix some memcached configuration error JIRA: COMPASS-192 Change-Id: I919afb3c109fed151d35d94e323111b85e44073b Signed-off-by: carey.xu --- .../adapters/ansible/openstack/HA-ansible-multinodes.yml | 11 +---------- deploy/adapters/ansible/openstack/templates/nova.conf | 9 ++++++++- deploy/adapters/ansible/roles/common/vars/main.yml | 4 +--- deploy/adapters/ansible/roles/dashboard/tasks/main.yml | 5 ----- deploy/adapters/ansible/roles/ha/templates/haproxy.cfg | 14 +++++++++----- .../ansible/roles/keystone/templates/keystone.conf | 11 ++++++++--- deploy/adapters/ansible/roles/memcached/tasks/main.yml | 13 +++++++++++++ deploy/adapters/ansible/roles/memcached/vars/Debian.yml | 7 +++++++ deploy/adapters/ansible/roles/memcached/vars/RedHat.yml | 7 +++++++ deploy/adapters/ansible/roles/memcached/vars/main.yml | 6 ++++++ 10 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 deploy/adapters/ansible/roles/memcached/tasks/main.yml create mode 100644 deploy/adapters/ansible/roles/memcached/vars/Debian.yml create mode 100644 deploy/adapters/ansible/roles/memcached/vars/RedHat.yml create mode 100644 deploy/adapters/ansible/roles/memcached/vars/main.yml (limited to 'deploy/adapters') diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 8dadd584..a60b3d05 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -1,21 +1,19 @@ --- - hosts: all remote_user: root - sudo: True roles: - common - setup-network - hosts: ha remote_user: root - sudo: True roles: - ha - hosts: controller remote_user: root - sudo: True roles: + - memcached - database - mq - keystone @@ -38,7 +36,6 @@ - hosts: compute remote_user: root - sudo: True roles: - nova-compute - neutron-compute @@ -47,13 +44,11 @@ - hosts: all remote_user: root - sudo: True roles: - odl_cluster - hosts: all remote_user: root - sudo: True roles: - onos_cluster @@ -65,24 +60,20 @@ - hosts: controller remote_user: root - sudo: True roles: - ext-network - hosts: ceph_adm remote_user: root - sudo: True roles: - ceph-deploy - hosts: all remote_user: root - sudo: True roles: - monitor - hosts: all remote_user: root - sudo: True roles: - secgroup diff --git a/deploy/adapters/ansible/openstack/templates/nova.conf b/deploy/adapters/ansible/openstack/templates/nova.conf index 2364132e..cec11440 100644 --- a/deploy/adapters/ansible/openstack/templates/nova.conf +++ b/deploy/adapters/ansible/openstack/templates/nova.conf @@ -1,3 +1,9 @@ +{% set memcached_servers = [] %} +{% for host in haproxy_hosts.values() %} +{% set _ = memcached_servers.append('%s:11211'% host) %} +{% endfor %} +{% set memcached_servers = memcached_servers|join(',') %} + [DEFAULT] dhcpbridge_flagfile=/etc/nova/nova.conf dhcpbridge=/usr/bin/nova-dhcpbridge @@ -49,7 +55,7 @@ notify_on_state_change = vm_and_task_state notification_driver = nova.openstack.common.notifier.rpc_notifier notification_driver = ceilometer.compute.nova_notifier -memcached_servers = {{ internal_vip.ip }}:11211 +memcached_servers = {{ memcached_servers }} [database] # The SQLAlchemy connection string used to connect to the database @@ -64,6 +70,7 @@ identity_uri = http://{{ internal_vip.ip }}:35357 admin_tenant_name = service admin_user = nova admin_password = {{ NOVA_PASS }} +memcached_servers = {{ memcached_servers }} [glance] host = {{ internal_vip.ip }} diff --git a/deploy/adapters/ansible/roles/common/vars/main.yml b/deploy/adapters/ansible/roles/common/vars/main.yml index e3dfa496..2c5b5679 100644 --- a/deploy/adapters/ansible/roles/common/vars/main.yml +++ b/deploy/adapters/ansible/roles/common/vars/main.yml @@ -2,7 +2,5 @@ packages_noarch: - python-pip - ntp - - memcached -services_noarch: - - memcached +services_noarch: [] diff --git a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml index 5afcb157..c9eccfb4 100644 --- a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml +++ b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml @@ -18,11 +18,6 @@ - name: remove ubuntu theme action: "{{ ansible_pkg_mgr }} name=openstack-dashboard-ubuntu-theme state=absent" -- name: update memcached conf - lineinfile: dest=/etc/memcached.conf state=present - regexp="-l *" - line="-l {{ internal_vip.ip }}" - - name: update ubuntu horizon settings template: src=local_settings_debian dest=/etc/openstack-dashboard/local_settings.py diff --git a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg index 0778bb13..7d783a30 100644 --- a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg +++ b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg @@ -169,12 +169,16 @@ listen proxy-ceilometer_api_cluster listen proxy-dashboarad bind {{ public_vip.ip }}:80 - option tcpka - option httpchk - option tcplog - balance source + mode http + balance source + capture cookie vgnvisitor= len 32 + cookie SERVERID insert indirect nocache + option forwardfor + option httpchk + option httpclose + rspidel ^Set-cookie:\ IP= {% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:80 weight 1 check inter 2000 rise 2 fall 5 + server {{ host }} {{ ip }}:80 cookie {{ host }} weight 1 check inter 2000 rise 2 fall 5 {% endfor %} listen stats diff --git a/deploy/adapters/ansible/roles/keystone/templates/keystone.conf b/deploy/adapters/ansible/roles/keystone/templates/keystone.conf index b022a084..22173e44 100644 --- a/deploy/adapters/ansible/roles/keystone/templates/keystone.conf +++ b/deploy/adapters/ansible/roles/keystone/templates/keystone.conf @@ -1,3 +1,8 @@ +{% set memcached_servers = [] %} +{% for host in haproxy_hosts.values() %} +{% set _ = memcached_servers.append('%s:11211'% host) %} +{% endfor %} +{% set memcached_servers = memcached_servers|join(',') %} [DEFAULT] admin_token={{ ADMIN_TOKEN }} @@ -518,8 +523,8 @@ log_dir = /var/log/keystone # (dogpile.cache.redis) be used in production deployments. # Small workloads (single process) like devstack can use the # dogpile.cache.memory backend. (string value) -#backend=keystone.common.cache.noop - +backend=keystone.cache.memcache_pool +memcache_servers={{ memcached_servers}} # Use a key-mangling function (sha1) to ensure fixed length # cache-keys. This is toggle-able for debugging purposes, it # is highly recommended to always leave this set to True. @@ -540,7 +545,7 @@ log_dir = /var/log/keystone # Global toggle for all caching using the should_cache_fn # mechanism. (boolean value) -#enabled=false +enabled=true # Extra debugging from the cache backend (cache keys, # get/set/delete/etc calls) This is only really useful if you diff --git a/deploy/adapters/ansible/roles/memcached/tasks/main.yml b/deploy/adapters/ansible/roles/memcached/tasks/main.yml new file mode 100644 index 00000000..8b955cbb --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: install packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" + with_items: packages | union(packages_noarch) + +- name: change memcache listen ip + lineinfile: dest=/etc/memcached.conf regexp="^-l " line="-l 0.0.0.0" + +- name: restart services + service: name={{ item }} state=restarted enabled=yes + with_items: services| union(services_noarch) diff --git a/deploy/adapters/ansible/roles/memcached/vars/Debian.yml b/deploy/adapters/ansible/roles/memcached/vars/Debian.yml new file mode 100644 index 00000000..7a0d09de --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/vars/Debian.yml @@ -0,0 +1,7 @@ +--- +packages: + - python-memcache + +services: [] + + diff --git a/deploy/adapters/ansible/roles/memcached/vars/RedHat.yml b/deploy/adapters/ansible/roles/memcached/vars/RedHat.yml new file mode 100644 index 00000000..8cd2462c --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/vars/RedHat.yml @@ -0,0 +1,7 @@ +--- +packages: + - python-memcached + +pip_packages: [] + +services: [] diff --git a/deploy/adapters/ansible/roles/memcached/vars/main.yml b/deploy/adapters/ansible/roles/memcached/vars/main.yml new file mode 100644 index 00000000..40c400a6 --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/vars/main.yml @@ -0,0 +1,6 @@ +--- +packages_noarch: + - memcached + +services_noarch: + - memcached -- cgit 1.2.3-korg