Skip to content
Snippets Groups Projects
Commit f8da0f8a authored by matt01671's avatar matt01671
Browse files

cleaned up files

parent 3f13e064
No related branches found
No related tags found
No related merge requests found
......@@ -3,19 +3,4 @@
script: ./templates/set-cluster-t.sh '{{ groups['dbs'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}'
register: outt
# - name: Build CouchDB Cluster
# script: ./templates/set-cluster-1.sh '{{ ansible_default_ipv4.address }}' '{{ groups['dbs'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}' '{{ groups['master'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}'
# register: out
# - name: Build CouchDB Cluster
# script: ./templates/set-cluster-2.sh '{{ ansible_default_ipv4.address }}' '{{ groups['dbs'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}' '{{ groups['master'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}'
# register: out2
# - name: Build CouchDB Cluster
# script: ./templates/set-cluster-3.sh '{{ ansible_default_ipv4.address }}' '{{ groups['dbs'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}' '{{ groups['master'] | map('extract', hostvars, ['ansible_host']) | join(' ') }}'
# register: out3
# - debug: var=out.stdout_lines
# - debug: var=out2.stdout_lines
# - debug: var=out3.stdout_lines
- debug: var=outt.stdout_lines
\ No newline at end of file
#!/usr/bin/env bash
echo "== Set variables =="
export user=admin
export pass=admin
export VERSION='3.0.0'
export cookie='a192aeb9904e6590849337933b000c99'
export uuid='a192aeb9904e6590849337933b001159'
export node=$1
export declare -a nodes=($2)
export masternode=$3
# for node in "${nodes[@]}"
# do
# echo ${node}
# done
# echo ${masternode}
echo "== Set up the CouchDB cluster: =="
curl -XPOST "http://${user}:${pass}@${masternode}:5984/_cluster_setup" \
--header "Content-Type: application/json"\
--data "{\"action\": \"enable_cluster\", \"bind_address\":\"0.0.0.0\",\
\"username\": \"${user}\", \"password\":\"${pass}\", \"port\": \"5984\",\
\"remote_node\": \"${node}\", \"node_count\": \"$(echo ${nodes[@]} | wc -w)\",\
\"remote_current_user\":\"${user}\", \"remote_current_password\":\"${pass}\"}"
\ No newline at end of file
#!/usr/bin/env bash
echo "== Set variables =="
export user=admin
export pass=admin
export VERSION='3.0.0'
export cookie='a192aeb9904e6590849337933b000c99'
export uuid='a192aeb9904e6590849337933b001159'
export node=$1
export masternode=$3
curl -XPOST "http://${user}:${pass}@${masternode}:5984/_cluster_setup"\
--header "Content-Type: application/json"\
--data "{\"action\": \"add_node\", \"host\":\"${node}\",\
\"port\": \"5984\", \"username\": \"${user}\", \"password\":\"${pass}\"}"
\ No newline at end of file
#!/usr/bin/env bash
echo "== Set variables =="
export user=admin
export pass=admin
export VERSION='3.0.0'
export cookie='a192aeb9904e6590849337933b000c99'
export uuid='a192aeb9904e6590849337933b001159'
export node=$1
export declare -a nodes=($2)
export masternode=$3
curl -XPOST "http://${user}:${pass}@${masternode}:5984/_cluster_setup"\
--header "Content-Type: application/json" --data "{\"action\": \"finish_cluster\"}"
echo "== Check wether the cluster configuration is correct: =="
for node in "${nodes[@]}"; do curl -X GET "http://${user}:${pass}@${node}:5984/_membership"; done
echo "== Adding a database to one node of the cluster makes it to be created on all other nodes as well: =="
curl -XPUT "http://${user}:${pass}@${masternode}:5984/twitter"
for node in "${nodes[@]}"; do curl -X GET "http://${user}:${pass}@${node}:5984/_all_dbs"; done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment