绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
cratedb 集群 docker-compose 安装试用
2022-05-06 17:06:31

关于集群的配置说明可以参考官方文档,或者es 文档

详细代码参考 https://github.com/rongfengliang/cratedb-cluster-docker

参考配置

  • docker-compose
version: "3"
services:
  crate1:
    image: crate
    volumes:
    - "./data1:/data"
    - "./1.yaml:/crate/config/crate.yml"
    ports:
    - "4200:4200"
    - "4300:4300"
    - "5432:5432"
  crate2:
    image: crate
    volumes:
    - "./data2:/data"
    - "./2.yaml:/crate/config/crate.yml"
    ports:
    - "4201:4200"
    - "4301:4300"
    - "5433:5432"
  crate3:
    image: crate
    volumes:
    - "./data3:/data"
    - "./3.yaml:/crate/config/crate.yml"
    ports:
    - "4202:4200"
    - "4302:4300"
    - "5434:5432"
  • 配置文件
master(一个):

1.yaml:

cluster.name: cratecluster
node.name: node1
node.master: true
node.data: true
http.port: 4200
psql.port: 5432
transport.tcp.port: 4300
discovery.zen.ping.unicast.hosts: ["crate1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
gateway.expected_nodes: 3
gateway.recover_after_nodes: 2
network.host: _local_,_site_
path.logs: /data/log
path.data: /data/data
blobs.path: /data/blobs

node(data):

2.yaml

cluster.name: cratecluster
node.name: node2
node.master: false
node.data: true
http.port: 4200
psql.port: 5432
transport.tcp.port: 4300
discovery.zen.ping.unicast.hosts: ["crate1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
gateway.expected_nodes: 3
gateway.recover_after_nodes: 2
network.host: _local_,_site_
path.logs: /data/log
path.data: /data/data
blobs.path: /data/blobs

3.yaml:

cluster.name: cratecluster
node.name: node3
node.master: false
node.data: true
http.port: 4200
psql.port: 5432
transport.tcp.port: 4300
discovery.zen.ping.unicast.hosts: ["crate1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: _local_,_site_
gateway.expected_nodes: 3
gateway.recover_after_nodes: 2
path.logs: /data/log
path.data: /data/data
blobs.path: /data/blobs

启动&&运行

  • 启动
docker-compose up -d
  • 查询集群节点
select count(*) from sys.nodes;
  • 查询node check
select id, node_id, description from sys.node_checks order by id, node_id;

参考界面

操作

  • 创建数据表
create table demoapp(id int ,name string, age int);

  • 插入数据
insert into demoapp(id,name,age) values(3,'dalong',3444);

  • 查询数据
select * from demoapp limit 100;

  • join 查询
 select a.* from tweets a join demoapp b on a.id = b.id limit 100;

  • 分片状态

  • 集群状态

参考资料

https://crate.io/docs/crate/reference/en/latest/config/node.html 
https://crate.io/docs/crate/reference/en/latest/admin/system-information.html#routing-allocation-disk-watermark-low 
https://crate.io/docs/crate/guide/en/latest/scaling/multi-node-setup.html 
https://github.com/rongfengliang/cratedb-cluster-docker

分享好友

分享这个小栈给你的朋友们,一起进步吧。

CrateDB
创建时间:2022-02-25 14:30:06
CrateDB
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • itt0918
    专家
戳我,来吐槽~