Need steps for clickhouse distributed query implementation












0














I have installed clickhouse in 2 different machines A(96GB RAM , 32 core) & B (96GB RAM , 32 core) and i also configured replica using zookeeper.
I am able to ingest and fetch the data from both the machines and replication also working fine.



Now i would like to utilize 2 clickhouse servers for single query to improve the query performance.



I tried for distributed query but i am failed to configure hence could please provide the clear steps to implement distributed query










share|improve this question



























    0














    I have installed clickhouse in 2 different machines A(96GB RAM , 32 core) & B (96GB RAM , 32 core) and i also configured replica using zookeeper.
    I am able to ingest and fetch the data from both the machines and replication also working fine.



    Now i would like to utilize 2 clickhouse servers for single query to improve the query performance.



    I tried for distributed query but i am failed to configure hence could please provide the clear steps to implement distributed query










    share|improve this question

























      0












      0








      0







      I have installed clickhouse in 2 different machines A(96GB RAM , 32 core) & B (96GB RAM , 32 core) and i also configured replica using zookeeper.
      I am able to ingest and fetch the data from both the machines and replication also working fine.



      Now i would like to utilize 2 clickhouse servers for single query to improve the query performance.



      I tried for distributed query but i am failed to configure hence could please provide the clear steps to implement distributed query










      share|improve this question













      I have installed clickhouse in 2 different machines A(96GB RAM , 32 core) & B (96GB RAM , 32 core) and i also configured replica using zookeeper.
      I am able to ingest and fetch the data from both the machines and replication also working fine.



      Now i would like to utilize 2 clickhouse servers for single query to improve the query performance.



      I tried for distributed query but i am failed to configure hence could please provide the clear steps to implement distributed query







      clickhouse






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 28 '18 at 11:02









      user3383468user3383468

      111




      111
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If I right understood you, the distributed query is executed just on one server utilizing both its replicas.



          To fix it need to change the strategy of replicas selection by the load balancer to in_order (it defined in user.xml):



          <yandex>
          <profiles>
          <default>
          <!-- .. -->
          <load_balancing>in_order</load_balancing>
          </default>
          </profiles>
          <!-- .. -->
          </yandex>


          Refs:



          https://clickhouse.yandex/docs/en/operations/settings/settings/#load-balancing
          https://clickhouse.yandex/docs/en/operations/table_engines/distributed/






          share|improve this answer





















          • I changed the load balance but still query utilizing single server resource
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
            – vladimir77
            Dec 30 '18 at 10:02













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53957481%2fneed-steps-for-clickhouse-distributed-query-implementation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If I right understood you, the distributed query is executed just on one server utilizing both its replicas.



          To fix it need to change the strategy of replicas selection by the load balancer to in_order (it defined in user.xml):



          <yandex>
          <profiles>
          <default>
          <!-- .. -->
          <load_balancing>in_order</load_balancing>
          </default>
          </profiles>
          <!-- .. -->
          </yandex>


          Refs:



          https://clickhouse.yandex/docs/en/operations/settings/settings/#load-balancing
          https://clickhouse.yandex/docs/en/operations/table_engines/distributed/






          share|improve this answer





















          • I changed the load balance but still query utilizing single server resource
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
            – vladimir77
            Dec 30 '18 at 10:02


















          0














          If I right understood you, the distributed query is executed just on one server utilizing both its replicas.



          To fix it need to change the strategy of replicas selection by the load balancer to in_order (it defined in user.xml):



          <yandex>
          <profiles>
          <default>
          <!-- .. -->
          <load_balancing>in_order</load_balancing>
          </default>
          </profiles>
          <!-- .. -->
          </yandex>


          Refs:



          https://clickhouse.yandex/docs/en/operations/settings/settings/#load-balancing
          https://clickhouse.yandex/docs/en/operations/table_engines/distributed/






          share|improve this answer





















          • I changed the load balance but still query utilizing single server resource
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
            – vladimir77
            Dec 30 '18 at 10:02
















          0












          0








          0






          If I right understood you, the distributed query is executed just on one server utilizing both its replicas.



          To fix it need to change the strategy of replicas selection by the load balancer to in_order (it defined in user.xml):



          <yandex>
          <profiles>
          <default>
          <!-- .. -->
          <load_balancing>in_order</load_balancing>
          </default>
          </profiles>
          <!-- .. -->
          </yandex>


          Refs:



          https://clickhouse.yandex/docs/en/operations/settings/settings/#load-balancing
          https://clickhouse.yandex/docs/en/operations/table_engines/distributed/






          share|improve this answer












          If I right understood you, the distributed query is executed just on one server utilizing both its replicas.



          To fix it need to change the strategy of replicas selection by the load balancer to in_order (it defined in user.xml):



          <yandex>
          <profiles>
          <default>
          <!-- .. -->
          <load_balancing>in_order</load_balancing>
          </default>
          </profiles>
          <!-- .. -->
          </yandex>


          Refs:



          https://clickhouse.yandex/docs/en/operations/settings/settings/#load-balancing
          https://clickhouse.yandex/docs/en/operations/table_engines/distributed/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 28 '18 at 18:32









          vladimir77vladimir77

          2,0241624




          2,0241624












          • I changed the load balance but still query utilizing single server resource
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
            – vladimir77
            Dec 30 '18 at 10:02




















          • I changed the load balance but still query utilizing single server resource
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
            – user3383468
            Dec 29 '18 at 6:01










          • It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
            – vladimir77
            Dec 30 '18 at 10:02


















          I changed the load balance but still query utilizing single server resource
          – user3383468
          Dec 29 '18 at 6:01




          I changed the load balance but still query utilizing single server resource
          – user3383468
          Dec 29 '18 at 6:01












          SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
          – user3383468
          Dec 29 '18 at 6:01




          SELECT name, value FROM system.settings WHERE name IN ('max_parallel_replicas', 'distributed_product_mode', 'load_balancing') ┌─name─────────────────────┬─value────┐ │ load_balancing │ in_order │ │ max_parallel_replicas │ 2 │ │ distributed_product_mode │ allow │ └──────────────────────────┴──────────┘
          – user3383468
          Dec 29 '18 at 6:01












          SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
          – user3383468
          Dec 29 '18 at 6:01




          SELECT * FROM clusters ┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name────┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐ │ logs │ 1 │ 1 │ 1 │ xx.xx.xx.142 │ xx.xx.xx.142 │ 9000 │ 1 │ default │ │ │ logs │ 1 │ 1 │ 2 │ xx.xx.xx.143 │ xx.xx.xx.143 │ 9000 │ 1 │ default │ │ └─────────┴───────────┴──────────────┴─────────────┴──────────────┴──────────────┴──────┴──────────┴─────────┴──────────────────┘
          – user3383468
          Dec 29 '18 at 6:01












          It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
          – vladimir77
          Dec 30 '18 at 10:02






          It looks like your cluster has just ONE shard and two replicas. The same query won't be parallelized between replicas, only between shards. You need to reconfigure cluster to have more than 1 shard. Please look at these articles: github.com/yandex/ClickHouse/issues/2161 altinity.com/blog/2018/5/10/…
          – vladimir77
          Dec 30 '18 at 10:02




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53957481%2fneed-steps-for-clickhouse-distributed-query-implementation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas