Skip to content

Commit

Permalink
Merge pull request #17 from nl2go/add_shard_settings
Browse files Browse the repository at this point in the history
modified templates which help to add more than one shard
  • Loading branch information
hasithaka authored Dec 4, 2020
2 parents c8c7b82 + 52cfea8 commit a780a7b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ before_script:
- wget https://raw.githubusercontent.com/nl2go/docker-molecule/3.0.4-n2g-1.0.0/docker-compose.yml
- docker-compose up -d

# script:
# - docker-compose exec -e HCLOUD_TOKEN="$HCLOUD_TOKEN" -e MOLECULE_TEST_SCOPE="$MOLECULE_TEST_SCOPE" -e MOLECULE_PLATFORM="$MOLECULE_PLATFORM" molecule molecule test --all
script:
- docker-compose exec -e HCLOUD_TOKEN="$HCLOUD_TOKEN" -e MOLECULE_TEST_SCOPE="$MOLECULE_TEST_SCOPE" -e MOLECULE_PLATFORM="$MOLECULE_PLATFORM" molecule molecule test --all
- /bin/true

after_script:
- docker-compose down
Expand Down
11 changes: 10 additions & 1 deletion templates/instances.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
<replication_test_1shards_2replicas>
<shard>
<internal_replication>true</internal_replication>
{% for node_hostname in groups['clickhouse'] %}
{% for node_hostname in groups['clickhouse_shard01'] %}
<replica>
<host>{{ node_hostname }}</host>
<port>{{ clickhouse_replication_port }}</port>
</replica>
{% endfor %}
</shard>
<shard>
<internal_replication>true</internal_replication>
{% for node_hostname in groups['clickhouse_shard02'] %}
<replica>
<host>{{ node_hostname }}</host>
<port>{{ clickhouse_replication_port }}</port>
Expand Down
5 changes: 5 additions & 0 deletions templates/macros.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<yandex>
<macros>
<cluster>{{ clickhouse_display_name | default('clickhouse') }}</cluster>
{% if node_hostname in groups['clickhouse_shard01'] %}
<shard>01</shard>
{% endif %}
{% if node_hostname in groups['clickhouse_shard02'] %}
<shard>02</shard>
{% endif %}
<replica>{{ inventory_hostname }}</replica>
</macros>
</yandex>

0 comments on commit a780a7b

Please sign in to comment.