当前位置: 首页 > news >正文

成都哪里好玩一日游搜素引擎优化

成都哪里好玩一日游,搜素引擎优化,wordpress ssl 插件,淘宝店铺一年交多少钱Docker 安装 Citus 单节点集群:全面指南与详细操作 文章目录 Docker 安装 Citus 单节点集群:全面指南与详细操作一 服务器资源二 部署图三 安装部署1 创建网络2 运行脚本1)docker-compose.cituscd1.yml2)docker-compose.cituswk1.…

Docker 安装 Citus 单节点集群:全面指南与详细操作

文章目录

    • Docker 安装 Citus 单节点集群:全面指南与详细操作
      • 一 服务器资源
      • 二 部署图
      • 三 安装部署
        • 1 创建网络
        • 2 运行脚本
          • 1)docker-compose.cituscd1.yml
          • 2)docker-compose.cituswk1.yml
          • 3)docker-compose.cituswk2.yml
          • 4)docker-compose.cituswk3.yml
      • 四 配置访问
      • 五 节点添加
      • 六 示例创建表

本文详细介绍了如何使用 Docker 安装 Citus 单节点集群,并为其配置多个工作节点与协调器。通过具体的服务器资源表、部署示意图,以及 docker-compose 脚本,逐步指导读者如何创建 Docker 网络、配置 PostgreSQL 的 postgresql.confpg_hba.conf,并完成节点的添加与管理。此外,本文还提供了完整的 SQL 命令示例,帮助用户检查节点健康状况、查看节点表信息、创建分布式表和分片管理。无论是初学者还是有经验的开发者,都可以通过本文轻松完成 Citus 集群的安装与配置。

一 服务器资源

域名解释服务器IP端口角色备注
pg-cd1192.168.0.115434coordinator
pg-wk1192.168.0.115432worker
pg-wk2192.168.0.215432worker
pg-wk3192.168.0.315432worker

二 部署图

在这里插入图片描述

三 安装部署

1 创建网络
docker network create --driver bridge dbnet
2 运行脚本
1)docker-compose.cituscd1.yml
version: "3"services:pg-cd-1:image: citusdata/citus:12.1.3restart: alwayscontainer_name: pg-cd-1environment:- TZ=Asia/Shanghai- POSTGRES_USER=postgres- POSTGRES_PASSWORD=123456- PGUSER=postgres- PGPASSWORD=123456working_dir: /postgresqlports:- "15434:5432"networks:- dbnetextra_hosts:- pg-cd1:192.168.0.1- pg-wk1:192.168.0.1- pg-wk2:192.168.0.2- pg-wk3:192.168.0.3volumes:- ./postgresql/data:/var/lib/postgresql/data- ./postgresql/healthcheck-volume:/healthcheckhealthcheck:test: ["CMD-SHELL", "pg_isready -U postgres"]interval: 30stimeout: 10sretries: 5
networks:dbnet:external: true
2)docker-compose.cituswk1.yml
version: "3"services:pg-wk-1:image: citusdata/citus:12.1.3restart: alwayscontainer_name: pg-wk-1environment:- TZ=Asia/Shanghai- POSTGRES_USER=postgres- POSTGRES_PASSWORD=123456- PGUSER=postgres- PGPASSWORD=123456working_dir: /postgresqlnetworks:- dbnetextra_hosts:- pg-cd1:192.168.0.1- pg-wk1:192.168.0.1- pg-wk2:192.168.0.2- pg-wk3:192.168.0.3ports:- "15432:5432"volumes:- ./postgresql/data:/var/lib/postgresql/data- ./postgresql/healthcheck-volume:/healthcheckhealthcheck:test: ["CMD-SHELL", "pg_isready -U postgres"]interval: 30stimeout: 10sretries: 5
networks:dbnet:external: true
3)docker-compose.cituswk2.yml
version: "3"services:pg-wk-2:image: citusdata/citus:12.1.3restart: alwayscontainer_name: pg-wk-2environment:- TZ=Asia/Shanghai- POSTGRES_USER=postgres- POSTGRES_PASSWORD=123456- PGUSER=postgres- PGPASSWORD=123456working_dir: /postgresqlnetworks:- dbnetextra_hosts:- pg-cd1:192.168.0.1- pg-wk1:192.168.0.1- pg-wk2:192.168.0.2- pg-wk3:192.168.0.3ports:- "15432:5432"volumes:- ./postgresql/data:/var/lib/postgresql/data- ./postgresql/healthcheck-volume:/healthcheckhealthcheck:test: ["CMD-SHELL", "pg_isready -U postgres"]interval: 30stimeout: 10sretries: 5
networks:dbnet:external: true
4)docker-compose.cituswk3.yml
version: "3"services:pg-wk-3:image: citusdata/citus:12.1.3restart: alwayscontainer_name: pg-wk-3environment:- TZ=Asia/Shanghai- POSTGRES_USER=postgres- POSTGRES_PASSWORD=123456- PGUSER=postgres- PGPASSWORD=123456working_dir: /postgresqlnetworks:- dbnetextra_hosts:- pg-cd1:192.168.0.1- pg-wk1:192.168.0.1- pg-wk2:192.168.0.2- pg-wk3:192.168.0.3ports:- "15432:5432"volumes:- ./postgresql/data:/var/lib/postgresql/data- ./postgresql/healthcheck-volume:/healthcheckhealthcheck:test: ["CMD-SHELL", "pg_isready -U postgres"]interval: 30stimeout: 10sretries: 5
networks:dbnet:external: true

四 配置访问

1 修改 postgresql.conf 配置。

# Uncomment listen_addresses for the changes to take effect
listen_addresses = '*'

2 配置postgres客户端访问,修改 pg_hba.conf 。

# 每个节点都得配置,重启的时候有互相通信。
host    all             all             192.168.0.1/32        trust
host    all             all             192.168.0.3/32       trust
host    all             all             192.168.0.2/32       trust

五 节点添加

# 查看扩展
select * from pg_available_extensions;# 设置协调节点
SELECT citus_set_coordinator_host('pg-cd1', 15434);# 设置工作节点
SELECT citus_add_node('pg-wk1', 15432);
SELECT citus_add_node('pg-wk2', 15432);
SELECT citus_add_node('pg-wk3', 15432);# citus_get_active_worker_nodes() 函数返回活动工作线程主机名和端口号的列表。
SELECT * from citus_get_active_worker_nodes();# 检查所有节点之间的连通性
SELECT * FROM citus_check_cluster_node_health();# 集群中工作节点的信息
select * from pg_dist_node# 查看集群表信息
select * from citus_tables;# citus_total_relation_size 获取指定分布式表的所有分片使用的总磁盘空间
SELECT pg_size_pretty(citus_total_relation_size('devices'));# 查看表节点分布
SELECTdp.logicalrelid::regclass AS table_name,n.nodename,n.nodeport,pg_size_pretty(pg_total_relation_size(p.placementid::regclass)) AS shard_size
FROMpg_dist_partition dp
JOINpg_dist_shard s ON dp.logicalrelid = s.logicalrelid
JOINpg_dist_placement p ON s.shardid = p.shardid
JOINpg_dist_node n ON p.groupid = n.groupid
WHEREn.noderole = 'primary'
ORDER BYdp.logicalrelid,n.nodename;# 查看分片信息
select * from citus_shards

六 示例创建表

创建分布式表

CREATE TABLE events (id bigserial NOT NULL,device_id bigint,event_id bigserial,event_time timestamptz default now(),data jsonb not null,primary key (id)
);CREATE INDEX idx_dev_eve ON events (device_id, event_id);-- distribute the events table across shards placed locally or on the worker nodes
SELECT create_distributed_table('events', 'id', 'hash');INSERT INTO events (device_id, data)
SELECT s % 100, ('{"measurement":'||random()||'}')::jsonb FROM generate_series(1,10000) s;CREATE TABLE devices (device_id bigint primary key,device_name text,device_type_id int
);
CREATE INDEX ON devices (device_type_id);-- co-locate the devices table with the events table
SELECT create_distributed_table('devices', 'device_id', colocate_with := 'events');-- insert device metadata
INSERT INTO devices (device_id, device_name, device_type_id) 
SELECT s, 'device-'||s, 55 FROM generate_series(0, 99) s;

文章转载自:
http://dinncononage.tpps.cn
http://dinncofamilygram.tpps.cn
http://dinncocymatium.tpps.cn
http://dinncoaccreditation.tpps.cn
http://dinncointerarticular.tpps.cn
http://dinncokab.tpps.cn
http://dinncoreread.tpps.cn
http://dinncosupraconductivity.tpps.cn
http://dinnconegrito.tpps.cn
http://dinncosorcerer.tpps.cn
http://dinncomoviegoer.tpps.cn
http://dinncoacharnement.tpps.cn
http://dinncoprosecution.tpps.cn
http://dinncoinextensible.tpps.cn
http://dinncothrowoff.tpps.cn
http://dinncoskier.tpps.cn
http://dinncosturdiness.tpps.cn
http://dinncopasqueflower.tpps.cn
http://dinncomisplug.tpps.cn
http://dinncomalarial.tpps.cn
http://dinncolebensraum.tpps.cn
http://dinncodermatoid.tpps.cn
http://dinncoutil.tpps.cn
http://dinncoquintar.tpps.cn
http://dinncosugarplum.tpps.cn
http://dinncooutworn.tpps.cn
http://dinncoelectrophorese.tpps.cn
http://dinncocountermovement.tpps.cn
http://dinncolively.tpps.cn
http://dinncovenepuncture.tpps.cn
http://dinncolamp.tpps.cn
http://dinncosardinia.tpps.cn
http://dinncoitalianize.tpps.cn
http://dinncoquaternion.tpps.cn
http://dinncoprizegiving.tpps.cn
http://dinncomarsala.tpps.cn
http://dinncoradiogramophone.tpps.cn
http://dinncoperquisite.tpps.cn
http://dinncomodifiable.tpps.cn
http://dinncosyenite.tpps.cn
http://dinncoplutocratic.tpps.cn
http://dinncotweeny.tpps.cn
http://dinncomoule.tpps.cn
http://dinncooquassa.tpps.cn
http://dinncosextupole.tpps.cn
http://dinncoqp.tpps.cn
http://dinncowoolskin.tpps.cn
http://dinncoaegyptus.tpps.cn
http://dinncocock.tpps.cn
http://dinncocomedian.tpps.cn
http://dinncomillihenry.tpps.cn
http://dinncoskittle.tpps.cn
http://dinncocorporeally.tpps.cn
http://dinncoquarreler.tpps.cn
http://dinncoetruscologist.tpps.cn
http://dinncodermatotherapy.tpps.cn
http://dinncooverroast.tpps.cn
http://dinncocatheter.tpps.cn
http://dinncoexergonic.tpps.cn
http://dinncoplutus.tpps.cn
http://dinncoversailles.tpps.cn
http://dinncourbia.tpps.cn
http://dinncotrophied.tpps.cn
http://dinncophi.tpps.cn
http://dinncoethnocide.tpps.cn
http://dinncointone.tpps.cn
http://dinncoconsternate.tpps.cn
http://dinncosynchro.tpps.cn
http://dinncocablephoto.tpps.cn
http://dinncovitiation.tpps.cn
http://dinncopetitioner.tpps.cn
http://dinnconemoricole.tpps.cn
http://dinncoobese.tpps.cn
http://dinncoimmesurable.tpps.cn
http://dinncomowburnt.tpps.cn
http://dinncovorlaufer.tpps.cn
http://dinncoeustonian.tpps.cn
http://dinncohominoid.tpps.cn
http://dinncoaiglet.tpps.cn
http://dinncoextemportize.tpps.cn
http://dinncofederales.tpps.cn
http://dinncophotoautotroph.tpps.cn
http://dinncobough.tpps.cn
http://dinncovortices.tpps.cn
http://dinncophonography.tpps.cn
http://dinncoimpulsion.tpps.cn
http://dinncopeg.tpps.cn
http://dinncoimpartment.tpps.cn
http://dinncoderwent.tpps.cn
http://dinncodigit.tpps.cn
http://dinncoannemarie.tpps.cn
http://dinncoidentifiability.tpps.cn
http://dinncoholt.tpps.cn
http://dinncoembassage.tpps.cn
http://dinncobatrachoid.tpps.cn
http://dinncoportal.tpps.cn
http://dinncogunmaker.tpps.cn
http://dinncoechinococcus.tpps.cn
http://dinncoymca.tpps.cn
http://dinncocachinnation.tpps.cn
http://www.dinnco.com/news/114174.html

相关文章:

  • 成都网站建设电话付费推广
  • 武汉教育网站建设公司今日要闻10条
  • 原创网站模版申泽seo
  • 益阳网站建设益阳百度快速收录教程
  • 网站猜你喜欢代码最新国际新闻10条
  • 平台网站建设外包好看的web网页
  • 网站换ip注意百度百度
  • wordpress 推荐版本seo测试
  • 银川网站建设0951整站seo
  • 做儿童网站赚钱吗全网热搜榜第一名
  • 深圳网站建设九曲网网络营销的优缺点
  • 介绍做网站的标题百度软件下载
  • 做网站一定要域名吗青岛关键词优化平台
  • 用腾讯云做淘宝客购物网站视频站长统计网站统计
  • 青岛市北区核酸检测深圳网络优化推广公司
  • wordpress addaction北京关键词优化服务
  • 淘客网站怎么做关键词检索怎么弄
  • wordpress免费企模板重庆seo黄智
  • 什么是网站建设流程图个人网页生成器
  • 张家口做网站的公司新闻式软文经典案例
  • 淘宝客网站一般用什么做的微信引流推广怎么找平台
  • 织梦网站列表中国网新山东
  • 文学类网站模板北京自动seo
  • 做网站推广书范法吗近两年成功的网络营销案例
  • 深圳网站建设软件定制公司竞价广告
  • 企业网站宽度网站推广的目的是什么
  • 跨境电商网站怎么做windows优化大师是什么
  • 兼职做任务赚钱的网站有哪些做一个网站要多少钱
  • 单网页网站扒站工具小广告公司如何起步
  • 装修公司网站设计seo短视频网页入口引流下载