Commit 429ee61e authored by Ross McDonald's avatar Ross McDonald
Browse files

Tested clustering. Added a few more knobs.

parent 23946e33
......@@ -21,8 +21,10 @@ install_version: stable
# NOTE:
# - Do not attempt to cluster previously-unclustered servers. This can lead to data loss.
# - This will overwrite your /etc/default/influxdb file (though it makes a backup)
# - This will overwrite your /etc/hosts file (though, again, it makes a backup)
cluster_servers: no
# When clustering is enabled, whether or not to overwrite the /etc/hosts file with raw
# IPs (may be useful if no DNS resolution).
overwrite_hosts_file: yes
# Whether to load sample data (randomly generated integers) into a test database
# NOTE: sample data cannot be loaded if authentication is enabled
......
......@@ -13,8 +13,8 @@ Vagrant.configure(2) do |config|
(1..BOX_COUNT).each do |machine_id|
config.vm.define "influx#{machine_id}" do |machine|
machine.vm.hostname = "influx#{machine_id}"
# machine.vm.network "private_network", ip: "10.0.3.#{1+machine_id}", virtualbox__intnet: true
machine.vm.network "public_network"
machine.vm.network "private_network", ip: "10.0.3.#{1+machine_id}", virtualbox__intnet: true
# machine.vm.network "public_network"
machine.vm.provider "virtualbox" do |v|
v.memory = 512
......
......@@ -6,8 +6,10 @@ install_version: stable
# NOTE:
# - Do not attempt to cluster previously-unclustered servers. This can lead to data loss.
# - This will overwrite your /etc/default/influxdb file (though it makes a backup)
# - This will overwrite your /etc/hosts file (though, again, it makes a backup)
cluster_servers: no
# When clustering is enabled, whether or not to overwrite the /etc/hosts file with raw
# IPs (may be useful if no DNS resolution).
overwrite_hosts_file: yes
# Whether to load sample data (randomly generated integers) into a test database
# NOTE: sample data cannot be loaded if authentication is enabled
......
---
- name: Configure hosts file
template: src=etc/hosts.j2 dest=/etc/hosts owner=root group=root mode=0644 backup=yes
- name: Update hosts configuration
template: src=etc/hosts.j2 dest=/etc/hosts force=yes backup=yes owner=root group=root mode=0644
when: overwrite_hosts_file
- name: Cluster servers
template: src=etc/default/influxdb.j2 dest=/etc/default/influxdb force=yes backup=yes owner=root group=root mode=0644
......
INFLUXD_OPTS="-hostname {{ ansible_hostname }}{% if ansible_hostname[-1:]|int != 1 %} -join {% for host in groups['all']|sort %}{% if hostvars[host]['ansible_hostname'][-1:]|int < ansible_hostname[-1:]|int %}{{ hostvars[host]['ansible_hostname'] }}:{{ meta_port }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %}"
INFLUXD_OPTS="-hostname {{ ansible_hostname }}{% if cluster_servers %} -join {% for host in groups['all']|sort %}{% if hostvars[host]['ansible_hostname'] != ansible_hostname %}{{ hostvars[host]['ansible_hostname'] }}:{{ meta_port }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %}"
127.0.0.1 {{ ansible_fqdn }} {{ ansible_hostname }} localhost localhost.localdomain localhost4 localhost4.localdomain4
{% for host in groups['all'] %}
{% if host != "localhost" and hostvars[host]['ansible_hostname'] != ansible_hostname %}
{{ hostvars[host]['ansible_all_ipv4_addresses'] | last }} {{ hostvars[host]['ansible_hostname'] }}
{% endif %}
{% endfor %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment