ClickHouse deployment

Clickhouse stand-alone deployment

  1. Upload the rpm package to the /opt/lagou/software/clickhouse directory

  2. Execute the command in the directory where the rpm is located rpm -ivh *.rpm
    Insert picture description here

  3. Execute start command

sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml

or

/etc/init.d/clickhouse-server start

Show successful startup:
Insert picture description here

  1. Client login is successful

Insert picture description here

clickhouse distributed deployment

  1. Follow the above steps to install the rpm package on the linux121 and linux123 machines
  2. Create a cluster configuration file vim /etc/metrika.xml
<yandex>
  <clickhouse_remote_servers>//自定义配置文件名字
    <perftest_3shards_1replicas> //自定义集群名字
      <shard>
        <internal_replication>true</internal_replication>
        <replica>
          <host>linux121</host> 
          <port>9000</port> 
        </replica>
      </shard>
      <shard>
        <replica>
          <internal_replication>true</internal_replication>
          <host>linux122</host>
          <port>9000</port>
        </replica>
      </shard>
      <shard>
        <internal_replication>true</internal_replication>
        <replica>
          <host>linux123</host>
          <port>9000</port>
        </replica>
      </shard>
    </perftest_3shards_1replicas>
  </clickhouse_remote_servers>
  <!--zookeeper相关配置--> 
  <zookeeper-servers>
    <node index="1">
      <host>linux121</host>
      <port>2181</port>
    </node>
    <node index="2">
      <host>linux122</host>
      <port>2181</port>
    </node>
    <node index="3">
      <host>linux123</host>
      <port>2181</port>
    </node>
  </zookeeper-servers>
  <macros>
    <replica>linux121</replica> 
  </macros>
  <networks>
    <ip>::/0</ip>
  </networks>
  <clickhouse_compression>
    <case>
      <min_part_size>10000000000</min_part_size>
      <min_part_size_ratio>0.01</min_part_size_ratio>
      <method>lz4</method>
    </case>
  </clickhouse_compression>
</yandex>
  1. Bind the new configuration file to /etc/clickhouse-server/config.xml
 <include_from>/etc/metrika.xml</include_from>

Insert picture description here

  1. Start the zookeeper of the cluster configuration
  2. Restart the system
clickhouse-server --config-file=/etc/clickhouse-server/config.xml
  1. client verification
SELECT *FROM system.clusters

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_38813363/article/details/113858752