openstack-ansible-os_swift/templates/rsyncd.conf.j2
Andy McCrae 53027de8c8 Setup rsync module per object server drive
This PR sets up rsync module per drive for swift object servers. This
improves resource distribution, and also allows us to utilise rsync
module changes to prevent disk writes to specific drives when they begin
filling up.

Enable this option by setting "swift_rsync_module_per_drive: True", this
will still default to False to match upstream defaults. Additionally the
rsync max connections has been increased to match upstream defaults.

Additionally we include rsync.d/*.conf files by default and set this
directory up, so that we can add individual configuration to disable
specific drives.

Change-Id: I2019cade5bf5f2878497d30ce738dff07786fa64
2016-05-16 11:57:46 +01:00

64 lines
2.2 KiB
Django/Jinja

# {{ ansible_managed }}
uid = {{ swift_system_user_name }}
gid = {{ swift_system_group_name }}
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = {{ swift_replication_address }}
[account]
max connections = {{ swift_account_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = /var/lock/account.lock
[container]
max connections = {{ swift_container_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = /var/lock/container.lock
{% if swift_rsync_module_per_drive %}
{### Set up per drive rsync modules #}
{### Lets get the default groups for drives and find the default storage_policy #}
{% set def_groups = [ 'account', 'container' ] %}
{% for policy in swift.storage_policies %}
{% if policy.policy.default is defined and policy.policy.default == True %}
{% set _update = def_groups.append(policy.policy.name) %}
{% endif %}
{% endfor %}
{### swift_vars needs to exist for swift_vars[setting] checks to work #}
{% if swift_vars is not defined %}
{% set swift_vars = {} %}
{% endif %}
{% set drives = swift_vars.drives | default(swift.drives | default([])) %}
{### Loop through the drives to determine if they are in the object group #}
{% for drive in drives %}
{% set devAdded = False %}
{### Check if groups is defined per host or drive #}
{% set groups = drives.groups | default(swift_vars.groups | default(swift.groups | default(def_groups))) %}
{% for group in groups %}
{% if group not in ['account', 'container'] %}
{### We only want to add a device once so check if it was added already #}
{% if not devAdded | bool %}
[object_{{ drive.name }}]
max connections = {{ swift_object_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = /var/lock/object_{{ drive.name }}.lock
{% endif %}
{% set devAdded = True %}
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
[object]
max connections = {{ swift_object_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = /var/lock/object.lock
{% endif %}
&include /etc/rsync.d