# citus-for-opengauss **Repository Path**: xudabiao2024/citus-for-opengauss ## Basic Information - **Project Name**: citus-for-opengauss - **Description**: No description available - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2025-05-09 - **Last Updated**: 2025-09-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README path_standby=/data/x30060124/standby primary_port=15432 standby_port=15532 PID=$(lsof -ti :$primary_port) if [ -n "$PID" ]; then echo "find process using port: $primary_port, PID: $PID" kill -9 $PID echo "process killed" else echo "not find $primary_port" fi PID2=$(lsof -ti :$standby_port) if [ -n "$PID2" ]; then echo "find process using port: $standby_port, PID: $PID2" kill -9 $PID2 echo "process killed" else echo "not find $standby_port" fi rm -rf $path_primary rm -rf $path_standby gs_initdb -D $path_primary --nodename=datanode1 -E UTF-8 --locale=en_US.UTF-8 -U $user -w $password gs_initdb -D $path_standby --nodename=datanode2 -E UTF-8 --locale=en_US.UTF-8 -U $user -w $password echo " enable_default_ustore_table=on enable_default_pcr_index=on listen_addresses = '0.0.0.0' port = $primary_port comm_control_port = $(($primary_port+10)) comm_sctp_port = $(($primary_port+20)) replconninfo1 = 'localhost=0.0.0.0 localport=$(($primary_port+1)) localheartbeatport=$(($primary_port+5)) localservice=$(($primary_port+4)) remotehost=127.0.0.1 remoteport=$(($standby_port+1)) remoteheartbeatport=$(($standby_port+5)) remoteservice=$(($standby_port+4))' remote_read_mode = non_authentication" | tee -a $path_primary/postgresql.conf echo " enable_default_ustore_table=on enable_default_pcr_index=on listen_addresses = '0.0.0.0' port = $standby_port comm_control_port = $(($standby_port+10)) comm_sctp_port = $(($standby_port+20)) replconninfo1 = 'localhost=0.0.0.0 localport=$(($standby_port+1)) localheartbeatport=$(($standby_port+5)) localservice=$(($standby_port+4)) remotehost=127.0.0.1 remoteport=$(($primary_port+1)) remoteheartbeatport=$(($primary_port+5)) remoteservice=$(($primary_port+4))' remote_read_mode = non_authentication" | tee -a $path_standby/postgresql.conf gs_ctl start -D $path_primary -M primary gs_ctl build -D $path_standby -b full gs_ctl query -D $path_primary gs_ctl query -D $path_standby # citus-for-opengauss #### 介绍 {**以下是 Gitee 平台说明,您可以替换此简介** Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) -- ENUM 相关用例 -- 创建一个枚举类型。 CREATE TYPE bugstatus AS ENUM ('create', 'modify', 'closed'); \dT+ bugstatus -- 添加一个标签值。 ALTER TYPE bugstatus ADD VALUE IF NOT EXISTS 'regress' BEFORE 'closed'; \dT+ bugstatus -- 重命名一个标签值。 ALTER TYPE bugstatus RENAME VALUE 'create' TO 'new'; \dT+ bugstatus CREATE TABLE bug_reports ( id int PRIMARY KEY, title TEXT NOT NULL, status bugstatus NOT NULL -- 使用枚举类型 ); alter type bugstatus rename to bs; INSERT INTO bug_reports VALUES (1, '页面错误', 'new'); -- error INSERT INTO bug_reports VALUES (2, '接口问题', 'open'); -- error drop type bugstatus; drop table bug_reports; -- success drop type bugstatus; -- schema 相关用例 create schema s1; create table s1.t1 (a int, b int); \d+ t1; ALTER SCHEMA s1 RENAME TO s2; drop schema s1 cascade; -- table 相关 create table t1 (a int); -- 1. 添加列 b ALTER TABLE t1 ADD COLUMN b INT; ALTER TABLE t1 ALTER COLUMN a TYPE BIGINT; -- 2. 重命名列 a 为 aa ALTER TABLE t1 RENAME COLUMN a TO aa; -- 3. 删除列 b ALTER TABLE t1 DROP COLUMN b; -- 4. 在 aa 列上创建索引 CREATE INDEX idx_t1_aa ON t1 (aa); -- reindex idx_t1_aa; -- 5. drop index idx_t1_aa; -- 5. 修改表名(例如改为 t2) ALTER TABLE t1 RENAME TO t2; -- 视图相关 -- 创建 CREATE VIEW dv AS SELECT 1 AS id, 'Hello' AS message, CURRENT_DATE AS today; --修改 CREATE OR REPLACE VIEW dv AS SELECT 1 AS id, 'Hello' AS message, CURRENT_DATE AS today, 'World' AS additional_info; -- 新增列 ALTER VIEW dv ALTER column id SET DEFAULT 10086; ALTER VIEW dv SET schema s1; ALTER VIEW dv RENAME TO dv1; drop view dv1; ALTER INDEX idx_t1_new SET (FILLFACTOR = 80); SELECT * from citus_set_coordinator_host('127.0.0.1', 15432); SELECT * from citus_add_node('127.0.0.1', 15532); SELECT * from citus_add_node('127.0.0.1', 15632); create table t1 (a int, b int, c int); create index on t1(a); create index on t1(b); create index on t1(c); SELECT create_distributed_table('t1', 'a', shard_count:=4); select alter_distributed_table('t1', 'b'); ./configure --gcc-version=10.3.1 CC=g++ CFLAGS='-O0' --prefix=$GAUSSHOME --3rd=$BINARYLIBS --enable-debug --enable-cassert --enable-thread-safety --with-readline --without-zlib && make -sj && make install mkdir build && cd build && ../configure && make -sj && make install make -C src/test/regress/ check-spq user=x30060124 password=Huawei12#$ cn_port=15432 dn0_port=15532 dn1_port=15632 ./bin/gs_ctl stop -D cn/ ./bin/gs_ctl stop -D dn0/ ./bin/gs_ctl stop -D dn1/ rm -rf cn/ rm -rf dn0/ rm -rf dn1/ ./bin/gs_initdb -w Huawei@123 -D cn --nodename=node1 ./bin/gs_initdb -w Huawei@123 -D dn0 --nodename=node1 ./bin/gs_initdb -w Huawei@123 -D dn1 --nodename=node1 echo " log_statement = 'all' log_min_messages = 'DEBUG1' allow_system_table_mods = ON password_encryption_type = 1 enable_pbe_optimization = OFF ssl = on shared_preload_libraries = 'spq' listen_addresses='*' port = $cn_port" | tee -a cn/postgresql.conf echo " log_statement = 'all' log_min_messages = 'DEBUG1' allow_system_table_mods = ON password_encryption_type = 1 ssl = on shared_preload_libraries = 'spq' listen_addresses='*' port = $dn0_port" | tee -a dn0/postgresql.conf echo " log_statement = 'all' log_min_messages = 'DEBUG1' allow_system_table_mods = ON password_encryption_type = 1 ssl = on shared_preload_libraries = 'spq' listen_addresses='*' port = $dn1_port" | tee -a dn1/postgresql.conf ./bin/gs_ctl start -D cn/ ./bin/gs_ctl start -D dn0/ ./bin/gs_ctl start -D dn1/ gsql -d postgres -p 15432 -r -U x30060124 -c "CREATE EXTENSION spq;" gsql -d postgres -p 15532 -r -U x30060124 -c "CREATE EXTENSION spq;" gsql -d postgres -p 15632 -r -U x30060124 -c "CREATE EXTENSION spq;" gsql -d postgres -p 15432 -r -U x30060124 -c "CREATE USER test WITH PASSWORD 'Huawei@123';GRANT ALL PRIVILEGES TO test;" gsql -d postgres -p 15532 -r -U x30060124 -c "CREATE USER test WITH PASSWORD 'Huawei@123';GRANT ALL PRIVILEGES TO test;" gsql -d postgres -p 15632 -r -U x30060124 -c "CREATE USER test WITH PASSWORD 'Huawei@123';GRANT ALL PRIVILEGES TO test;" echo " host all all 0.0.0.0/0 md5 host replication gaussdb 0.0.0.0/0 md5" | tee -a cn/pg_hba.conf echo " host all all 0.0.0.0/0 md5 host replication gaussdb 0.0.0.0/0 md5" | tee -a dn0/pg_hba.conf echo " host all all 0.0.0.0/0 md5 host replication gaussdb 0.0.0.0/0 md5" | tee -a dn1/pg_hba.conf ./bin/gs_ctl restart -D cn/ ./bin/gs_ctl restart -D dn0/ ./bin/gs_ctl restart -D dn1/