From 2a9a4e6b4ceb2ad3b5150b7a9e376f74bc3006fa Mon Sep 17 00:00:00 2001 From: yabinji <109273041+yabinji@users.noreply.github.com> Date: Tue, 12 Mar 2024 11:24:37 +0800 Subject: [PATCH 1/2] fix: modify service port from 5432 to 26000 (#369) --- addons/mogdb/templates/clusterdefinition.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/mogdb/templates/clusterdefinition.yaml b/addons/mogdb/templates/clusterdefinition.yaml index e326e29ea..64be2c0b9 100644 --- a/addons/mogdb/templates/clusterdefinition.yaml +++ b/addons/mogdb/templates/clusterdefinition.yaml @@ -75,7 +75,7 @@ spec: service: ports: - name: tcp-mogdb - port: 5432 + port: 26000 targetPort: tcp-mogdb volumeTypes: - name: data @@ -114,13 +114,12 @@ spec: else MogDB_Role="standby" + pgport="5432" if [ -n "$PGPORT" ];then - ha_port=$(expr $PGPORT + 1) - ha_service_port=$(expr $PGPORT + 2) - else - ha_port=$(expr 5432 + 1) - ha_service_port=$(expr 5432 + 2) + pgport="$PGPORT" fi + ha_port=$(expr $pgport + 1) + ha_service_port=$(expr $pgport + 2) cat >/tmp/replconninfo.conf for ((i=0; i<$ordinal; i++)); do From 9347226b5031c847657354fa5b6152505b8b152f Mon Sep 17 00:00:00 2001 From: Shanshan Date: Tue, 12 Mar 2024 14:07:00 +0800 Subject: [PATCH 2/2] chore: update roles (#370) --- addons/mogdb/templates/clusterdefinition.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mogdb/templates/clusterdefinition.yaml b/addons/mogdb/templates/clusterdefinition.yaml index 64be2c0b9..280b8e068 100644 --- a/addons/mogdb/templates/clusterdefinition.yaml +++ b/addons/mogdb/templates/clusterdefinition.yaml @@ -17,10 +17,10 @@ spec: workloadType: Stateful rsmSpec: roles: - - name: Primary + - name: primary accessMode: ReadWrite isLeader: true - - name: Standby + - name: secondary accessMode: Readonly isLeader: false roleProbe: @@ -31,10 +31,10 @@ spec: - -c - | role=$(gsql -h 127.0.0.1 -p 26000 -U ${MOGDB_USER} -W "${MOGDB_PASSWORD}" -dpostgres -t -c "select local_role from pg_stat_get_stream_replications() limit 1" | xargs echo -n) - if [ "$role"x == "Normal"x ]; then - echo -n "Primary" + if [[ "$role"x == "Normal"x || "$role"x == "Primary"x ]]; then + echo -n "primary" else - echo -n $role + echo -n "secondary" fi characterType: mogdb configSpecs: