日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長(zhǎng)提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請(qǐng)做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

目錄
  • 1. 拉取鏡像
  • 2. clickhouse單機(jī)版
    • 2.1. 配置容器
    • 2.2. 測(cè)試jdbc連接
  • 3 clickhouse集群版
    • 3.1. 修改集群配置
    • 3.2. 編輯docker-compose.yml
    • 3.3. 啟動(dòng)CH集群
    • 3.4. 測(cè)試
  • 4. 存在的解決問題
    • 4.1. Permission denied

1. 拉取鏡像

docker pull clickhouse/clickhouse-server:22.3.11.12-alpine

2. clickhouse單機(jī)版

2.1. 配置容器

因?yàn)槿缦略颍枰獙lickhouse的配置文件及數(shù)據(jù)目錄復(fù)制到宿主機(jī)

  • 修改配置文件
  • 避免容器重啟時(shí),丟失數(shù)據(jù)文件
#啟動(dòng)容器
docker run -d --name ch-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server:22.3.11.12-alpine
# 復(fù)制文件到宿主機(jī)
docker cp ch-server:/etc/clickhouse-server D:/docker/ch/etc/clickhouse-server
docker cp ch-server:/var/lib/clickhouse D:/docker/ch/data
#停止容器
docker stop ch-server
# 再次啟動(dòng)容器
docker run -d --name=single-ch-server -p 8123:8123 -p 9000:9000 -p 9009:9009 --ulimit nofile=262144:262144 -v D:/docker/ch/data:/var/lib/clickhouse:rw -v D:/docker/ch/etc/clickhouse-server:/etc/clickhouse-server:rw clickhouse/clickhouse-server:22.3.11.12-alpine

2.2. 測(cè)試jdbc連接

啟動(dòng)成功后,使用DBeaver測(cè)試,用戶名default,密碼為空,則可以正常連接。

docker for windonws之Windows 10 家庭中文版安裝clickhouse 22.3版本及配置過程

3 clickhouse集群版

3.1. 修改集群配置

  • 將配置、日志放在ch01目錄下
  • 修改 D:\docker\ch\ch01\etc\clickhouse-server下的config.xml中,刪除 <remote_servers>節(jié)點(diǎn)并添加如下信息
	<include_from>/etc/clickhouse-server/metrika01.xml</include_from>
	<remote_servers incl="clickhouse_remote_servers" optional="true"/>
	<zookeeper incl="zookeeper_servers" optional="true"/>
	<macros incl="macros" optional="true"/>
    <!--MergeTree引擎表的數(shù)據(jù)壓縮設(shè)置,在metrika.xml-->
    <compression incl="clickhouse_compression"></compression>
  • 新增metrika01.xml文件,內(nèi)容如下:
  • 考慮到一臺(tái)筆記本的資源比較有限,所以就安裝單個(gè)節(jié)點(diǎn)的zk, clickhouse的集群也是2分片1副本的。
<?xml version="1.0"?>
<yandex>
    <clickhouse_remote_servers>
      <cluster01>
            <shard>
                <internal_replication>true</internal_replication>
				<weight>1</weight>
                <replica>
                    <host>ch01</host>
                    <port>9000</port>
                    <user>default</user>
                    <password></password>
                </replica>
            </shard>
			<shard>
                <internal_replication>true</internal_replication>
				<weight>1</weight>
                <replica>
                    <host>ch02</host>
                    <port>9000</port>
                    <user>default</user>
                    <password></password>
                </replica>
            </shard>
		</cluster01>
    </clickhouse_remote_servers>

    <macros>
        <layer>01</layer>
        <shard>01</shard>
        <replica>ch01</replica>
    </macros>

    <zookeeper_servers>
        <node index="1">
            <host>zk01</host>
            <port>2181</port>
        </node>
    </zookeeper_servers>

   <networks>
     <ip>::/0</ip>
   </networks>

  <clickhouse_compression>
    <case>
      <min_part_size>1073741824</min_part_size>
      <min_part_size_ratio>0.01</min_part_size_ratio>
      <method>lz4</method>
    </case>
  </clickhouse_compression>
</yandex>

節(jié)點(diǎn)ch02的配置:復(fù)制ch01目錄,產(chǎn)生ch02目錄

修改metrika01.xml,將macros內(nèi)容調(diào)整,其它配置與上面一致。

   <macros>
        <layer>01</layer>
        <shard>02</shard>
        <replica>ch02</replica>
    </macros>

3.2. 編輯docker-compose.yml

采用卷標(biāo)的方式掛載數(shù)據(jù)

version: '3.1'
services:
  zookeeper:
    image: zookeeper:3.4.14
    ports:
      - "8181:2181"
      - "8182:2182"
    hostname: zk01
  ch01:
    image: clickhouse/clickhouse-server:22.3.11.12-alpine
    restart: on-failure
    container_name: ch01
    ports:
      - 9000:9000
      - 8123:8123
      - 9009:9009
    volumes:
      - ch1-data:/var/lib/clickhouse
      - D:/docker/ch/ch01/etc/clickhouse-server:/etc/clickhouse-server:rw
      - D:/docker/ch/ch01/log:/var/log/clickhouse-server:rw
    hostname: ch01
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    depends_on:
      - "zookeeper"
  ch02:
    image: clickhouse/clickhouse-server:22.3.11.12-alpine
    restart: on-failure
    container_name: ch02
    ports:
      - 9800:9000
      - 8823:8123
      - 9809:9009
    volumes:
      - ch2-data:/var/lib/clickhouse
      - D:/docker/ch/ch02/etc/clickhouse-server:/etc/clickhouse-server:rw
      - D:/docker/ch/ch02/log:/var/log/clickhouse-server:rw
    hostname: ch02
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    depends_on:
      - "zookeeper"
volumes:
  ch1-data:
  ch2-data:

3.3. 啟動(dòng)CH集群

docker-compose up -d

3.4. 測(cè)試

create database test on cluster cluster01;
use test;
create table events_local on cluster cluster01 (
	ID String,
	EventType UInt8,
	URL String,
	EventTime DateTime
) ENGINE = MergeTree()
PARTITION BY toStartOfDay(EventTime)
ORDER BY (EventTime,EventType)
SETTINGS index_granularity = 8192;

create table events on cluster cluster01 as test.events_local ENGINE = Distributed('cluster01', 'test', 'events_local', rand());

insert into events(ID,EventType,URL,EventTime) values ('11',1,'http://www.baidu.com','2021-12-20 12:00:00');
insert into events(ID,EventType,URL,EventTime) values ('12',1,'http://www.baidu.com','2021-12-20 12:00:00');
insert into events(ID,EventType,URL,EventTime) values ('13',1,'http://www.baidu.com','2021-12-20 12:00:00');
insert into events(ID,EventType,URL,EventTime) values ('14',1,'http://www.baidu.com','2021-12-20 12:00:00');
insert into events(ID,EventType,URL,EventTime) values ('15',1,'http://www.baidu.com','2021-12-20 12:00:00');
insert into events(ID,EventType,URL,EventTime) values ('16',1,'http://www.baidu.com','2021-12-20 12:00:00');

4. 存在的解決問題

4.1. Permission denied

將Clickhouse的數(shù)據(jù)目錄放在宿主機(jī)時(shí),在插入數(shù)據(jù)時(shí)報(bào)如下錯(cuò)誤,但如果不放在宿主機(jī),則數(shù)據(jù)會(huì)丟失。

Received exception from server (version 22.3.11):
Code: 1001. DB::Exception: Received from localhost:9000. DB::Exception: std::__1::__fs::filesystem::filesystem_error: filesystem error: in rename: Permission denied [/var/lib/clickhouse/store/0d4/0d4a6f52-b3a6-4496-8174-e03ae9503321/tmp_insert_1639958400_1_1_0/] [/var/lib/clickhouse/store/0d4/0d4a6f52-b3a6-4496-8174-e03ae9503321/1639958400_1_1_0/]. (STD_EXCEPTION)
  • 采用將宿主機(jī) 路徑直接掛載到本地,比較直觀,但需要管理本地的路徑,但這種方式在clickhouse寫數(shù)據(jù)時(shí),會(huì)報(bào):Permission denied
  • 使用卷標(biāo)的方式,比較簡(jiǎn)潔,但你不知道數(shù)據(jù)存在本地什么位置,但這種方式在clickhouse寫數(shù)據(jù)時(shí)是正常的

目前不清楚具體的原因,如果你知道,煩請(qǐng)告知。 4.2. Ports are not available

報(bào)錯(cuò)信息:Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:8848 -> 0.0.0.0:0: listen tcp 0.0.0.0:8848: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

通過cmd命令查看哪些端口被禁用TCP協(xié)議

netsh interface ipv4 show excludedportrange protocol=tcp

將docker啟動(dòng)命令中的宿主機(jī)端口改成禁用之外的就可以了

docker for windonws之Windows 10 家庭中文版安裝clickhouse 22.3版本及配置過程

分享到:
標(biāo)簽:中文版 安裝 版本 過程 配置
用戶無頭像

網(wǎng)友整理

注冊(cè)時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊(cè)賬號(hào),推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫(kù),初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績(jī)?cè)u(píng)定2018-06-03

通用課目體育訓(xùn)練成績(jī)?cè)u(píng)定