From db355a0279f86020949d9a5e463bb85bd7129c8f Mon Sep 17 00:00:00 2001 From: zcp100_zcp100 Date: Fri, 15 Jul 2022 11:42:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add(mogdb):=E6=96=B0=E5=A2=9Eptk=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E6=96=87=E6=A1=A3+=E5=B0=91=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MogDB-MySQL-compatibility.md | 8 +- .../MogDB-Oracle-compatibility.md | 2 +- .../reference-guide/oracle-plugins/dolphin.md | 647 +++++++++++++++ .../reference-guide/oracle-plugins/whale.md | 221 +++++ product/en/docs-ptk/v0.2/command.md | 74 ++ .../commands/ptk-candidate-mogdb-server.md | 28 + .../v0.2/commands/ptk-candidate-os.md | 28 + .../docs-ptk/v0.2/commands/ptk-candidate.md | 33 + .../en/docs-ptk/v0.2/commands/ptk-checkos.md | 96 +++ .../v0.2/commands/ptk-cluster-restart.md | 53 ++ .../v0.2/commands/ptk-cluster-start.md | 53 ++ .../v0.2/commands/ptk-cluster-status.md | 49 ++ .../v0.2/commands/ptk-cluster-stop.md | 46 ++ .../en/docs-ptk/v0.2/commands/ptk-cluster.md | 31 + .../v0.2/commands/ptk-completion-bash.md | 44 + .../v0.2/commands/ptk-completion-fish.md | 32 + .../commands/ptk-completion-powershell.md | 26 + .../v0.2/commands/ptk-completion-zsh.md | 46 ++ .../docs-ptk/v0.2/commands/ptk-completion.md | 27 + .../en/docs-ptk/v0.2/commands/ptk-encrypt.md | 28 + product/en/docs-ptk/v0.2/commands/ptk-env.md | 28 + .../docs-ptk/v0.2/commands/ptk-gen-om-xml.md | 30 + .../en/docs-ptk/v0.2/commands/ptk-install.md | 149 ++++ product/en/docs-ptk/v0.2/commands/ptk-ls.md | 41 + .../v0.2/commands/ptk-self-upgrade.md | 24 + product/en/docs-ptk/v0.2/commands/ptk-self.md | 29 + .../v0.2/commands/ptk-template-create.md | 30 + .../en/docs-ptk/v0.2/commands/ptk-template.md | 71 ++ .../docs-ptk/v0.2/commands/ptk-uninstall.md | 44 + .../en/docs-ptk/v0.2/commands/ptk-version.md | 37 + product/en/docs-ptk/v0.2/config.md | 782 ++++++++++++++++++ product/en/docs-ptk/v0.2/debug.md | 36 + product/en/docs-ptk/v0.2/faq.md | 30 + product/en/docs-ptk/v0.2/install.md | 50 ++ product/en/docs-ptk/v0.2/overview.md | 49 ++ product/en/docs-ptk/v0.2/quick-start.md | 127 +++ product/en/docs-ptk/v0.2/release.md | 57 ++ product/en/docs-ptk/v0.2/usage.md | 256 ++++++ .../ptk-based-installation.md | 4 +- .../installation-on-a-single-node.md | 4 +- 40 files changed, 3441 insertions(+), 9 deletions(-) create mode 100644 product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/dolphin.md create mode 100644 product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/whale.md create mode 100644 product/en/docs-ptk/v0.2/command.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-candidate-mogdb-server.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-candidate-os.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-candidate.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-checkos.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-cluster-restart.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-cluster-start.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-cluster-status.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-cluster-stop.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-cluster.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-completion-bash.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-completion-fish.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-completion-powershell.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-completion-zsh.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-completion.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-encrypt.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-env.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-gen-om-xml.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-install.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-ls.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-self-upgrade.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-self.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-template-create.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-template.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-uninstall.md create mode 100644 product/en/docs-ptk/v0.2/commands/ptk-version.md create mode 100644 product/en/docs-ptk/v0.2/config.md create mode 100644 product/en/docs-ptk/v0.2/debug.md create mode 100644 product/en/docs-ptk/v0.2/faq.md create mode 100644 product/en/docs-ptk/v0.2/install.md create mode 100644 product/en/docs-ptk/v0.2/overview.md create mode 100644 product/en/docs-ptk/v0.2/quick-start.md create mode 100644 product/en/docs-ptk/v0.2/release.md create mode 100644 product/en/docs-ptk/v0.2/usage.md diff --git a/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-MySQL-compatibility.md b/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-MySQL-compatibility.md index 46dc1235..274ae86a 100644 --- a/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-MySQL-compatibility.md +++ b/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-MySQL-compatibility.md @@ -13,13 +13,13 @@ This feature is available since MogDB 3.0.0. ## Introduction -This feature mainly enhances the compatibility of MogDB with MySQL in the following three aspects. At the same time, support compatible with `insert` syntax, `insert into` can be abbreviated as `insert`. +This feature mainly enhances the compatibility of MogDB with MySQL in the following three aspects. At the same time, the `insert` syntax is supported, and `insert into` can be abbreviated as `insert`. -Support user lock, allowing users to add custom locks through SQL, which allows multiple programs to complete the locking-related interaction process, making the client access from any location to get a consistent lock view. +User lock allows users to add custom locks through SQL, which allows multiple programs to complete the lock-related interaction process, making the client access from any location to get a consistent lock view. -Support default record insert current time when inserting data when building a table; when updating data, if no update time is specified, the current time of data change is displayed by default. +When data is inserted into a table to be created, the current time is inserted by default. During data update, if the update time is not specified, the time when the data is updated is displayed by default. -Support setting session-level SQL mode, allowing runtime changes, global changes and intra-session changes. +Session-level SQL mode can be set, allowing change in running, global change, and intra-session change. ## Benefits diff --git a/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-Oracle-compatibility.md b/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-Oracle-compatibility.md index 248b11df..2d81288d 100644 --- a/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-Oracle-compatibility.md +++ b/product/en/docs-mogdb/v3.0/characteristic-description/application-development-interfaces/MogDB-Oracle-compatibility.md @@ -23,7 +23,7 @@ For more information about the functions and the packages, please see the [whale ## Benefits -Enhance MogDB's compatibility with Oracle by using the whale extension to enhance MogDB's functionality. +MogDB's compatibility with Oracle is enhanced by using the whale extension to enhance MogDB functions. ## Related Pages diff --git a/product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/dolphin.md b/product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/dolphin.md new file mode 100644 index 00000000..9c816995 --- /dev/null +++ b/product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/dolphin.md @@ -0,0 +1,647 @@ +--- +title: dolphin +summary: dolphin +author: Zhang Cuiping +date: 2022-06-27 +--- + +# dolphin + +## Introduction + +dolphin is a MySQL compatibility extension package of MogDB, in which MySQL data types and functions are added. + +## dolphin Installation + +For details, see [gs_install_plugin](../../reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install_plugin.md) or [gs_install_plugin_local](../../reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install_plugin_local.md)。 + +## dolphin Usage + +- Create the dolphin extension. + + ```sql + CREATE EXTENSION dolphin; + ``` + +- Check all modes. + + ```text + \dn + ``` + +## Example + +- Set sql_mode to sql_mode_full_group + + ```sql + create extension dolphin; + set sql_mode = 'sql_mode_full_group'; + create table test_group(a int, b int, c int, d int); + create table test_group1(a int, b int, c int, d int); + insert into test_group values(1,2,3,4); + insert into test_group values(1,3,4,5); + insert into test_group values(2,4,5,6); + insert into test_group values(3,5,6,7); + insert into test_group values(2,4,4,5); + insert into test_group values(3,3,4,5); + insert into test_group values(3,3,4,6); + insert into test_group1 values(1,2,3,4); + insert into test_group1 values(1,3,4,5); + select a, b from test_group group by a; + ERROR: column "test_group.b" must appear in the GROUP BY clause or be used in an aggregate function + LINE 1: select a, b from test_group group by a; + ^ + select a, d as items, (select count(*) from test_group t where t.a = i.a and b in (select b from test_group1 where c = 4)) as third from test_group i group by a; + ERROR: column "i.d" must appear in the GROUP BY clause or be used in an aggregate function + LINE 1: select a, d as items, (select count(*) from test_group t whe... + ^ + select t.a, (select sum(b) from test_group i where i.b = t.b ) from test_group t where t.a > 1+1 or (t.b < 8 and t.b > 1) group by t.a; + ERROR: subquery uses ungrouped column "t.b" from outer query + LINE 1: ...t.a, (select sum(b) from test_group i where i.b = t.b ) from... + ^ + set sql_mode = ''; + select a, b from test_group group by a; + a | b + ---+--- + 1 | 2 + 3 | 5 + 2 | 4 + (3 rows) + + select a, d as items, (select count(*) from test_group t where t.a = i.a and b in (select b from test_group1 where c = 4)) as third from test_group i group by a; + a | items | third + ---+-------+------- + 1 | 4 | 1 + 3 | 7 | 2 + 2 | 6 | 0 + (3 rows) + + select t.a, (select sum(b) from test_group i where i.b = t.b ) from test_group t where t.a > 1+1 or (t.b < 8 and t.b > 1) group by t.a; + a | sum + ---+----- + 1 | 2 + 3 | 5 + 2 | 8 + (3 rows) + ``` + +- Set sql_mode to sql_mode_strict + + ```sql + set sql_mode = 'sql_mode_strict'; + create table test_int(a int); + insert into test_int(a) values(-55); + insert into test_int(a) values(55); + insert into test_int(a) values(35589898923423423423423423); + insert into test_int(a) values(-3553434343434343432434); + insert into test_int(a) values('a888'); + insert into test_int(a) values('88123423433834343423434aa'); + insert into test_int(a) values('-88aa'); + insert into test_int(a) values(1234233434343434343434343434343.55); + insert into test_int(a) values(12.55); + insert into test_int(a) values(-12.55); + insert into test_int(a) values(-12123451343434343434343434343434.55); + insert into test_int(a) values(1.4e300); + insert into test_int(a) values(-1.4e300); + select * from test_int; + a + ------------- + -55 + 55 + 2147483647 + -2147483648 + 0 + 2147483647 + -88 + 2147483647 + 13 + -13 + -2147483648 + 2147483647 + -2147483648 + (13 rows) + + + set sql_mode = 'sql_mode_strict'; + insert into test_int_strict(a) values(-55); + insert into test_int_strict(a) values(55); + insert into test_int_strict(a) values(35589898923423423423423423); + ERROR: integer out of range + CONTEXT: referenced column: a + insert into test_int_strict(a) values(-3553434343434343432434); + ERROR: integer out of range + CONTEXT: referenced column: a + insert into test_int_strict(a) values('a888'); + ERROR: invalid input syntax for integer: "a888" + LINE 1: insert into test_int_strict(a) values('a888'); + ^ + CONTEXT: referenced column: a + insert into test_int_strict(a) values('88123423433834343423434aa'); + ERROR: value "88123423433834343423434aa" is out of range for type integer + LINE 1: insert into test_int_strict(a) values('881234234338343434234... + ^ + CONTEXT: referenced column: a + insert into test_int_strict(a) values('-88aa'); + ERROR: invalid input syntax for integer: "-88aa" + LINE 1: insert into test_int_strict(a) values('-88aa'); + ^ + CONTEXT: referenced column: a + insert into test_int_strict(a) values(1234233434343434343434343434343.55); + ERROR: integer out of range + CONTEXT: referenced column: a + insert into test_int_strict(a) values(12.55); + insert into test_int_strict(a) values(-12.55); + insert into test_int_strict(a) values(-12123451343434343434343434343434.55); + ERROR: integer out of range + CONTEXT: referenced column: a + insert into test_int_strict(a) values(1.4e300); + ERROR: integer out of range + CONTEXT: referenced column: a + insert into test_int_strict(a) values(-1.4e300); + ERROR: integer out of range + CONTEXT: referenced column: a + select * from test_int_strict; + a + ----- + -55 + 55 + 13 + -13 + (4 rows) + ``` + +- timestamp on update example + - on update syntax: empty value, modified value, the query result that is not changed on update + + ```sql + create table update_test_e(a int, b timestamp on update current_timestamp); + CREATE TABLE + insert into update_test_e values(1); + INSERT 0 1 + insert into update_test_e values(2); + INSERT 0 1 + select * from update_test_e; + a | b + ---+--- + 1 | + 2 | + (2 rows) + update update_test_e set a = 11 where a = 1; + UPDATE 1 + select * from update_test_e; + a | b + ----+---------------------------- + 2 | + 11 | 2022-06-27 14:04:34.873645 + (2 rows) + update update_test_e set a = 11 where a = 11; + UPDATE 1 + select * from update_test_e; + select * from update_test_e; + a | b + ----+---------------------------- + 2 | + 11 | 2022-06-27 14:04:34.873645 + (2 rows) + drop table update_test_e; + DROP TABLE + ``` + + - on update syntax: default expression and on update expression + + ```sql + create table update_test_f(a int, b timestamp default current_timestamp on update current_timestamp); + CREATE TABLE + insert into update_test_f values(1); + INSERT 0 1 + insert into update_test_f values(2); + INSERT 0 1 + select * from update_test_f; + a | b + ---+---------------------------- + 1 | 2022-06-27 14:07:36.174175 + 2 | 2022-06-27 14:07:38.05313 + (2 rows) + update update_test_f set a = 11 where a = 1; + UPDATE 1 + select * from update_test_f; + a | b + ----+--------------------------- + 2 | 2022-06-27 14:07:38.05313 + 11 | 2022-06-27 14:07:49.04924 + (2 rows) + drop table update_test_f; + DROP TABLE + ``` + + - on update syntax: on update included in multiple fields + + ```sql + create table update_test_g(a int, b timestamp default current_timestamp on update current_timestamp, c timestamp on update current_timestamp); + CREATE TABLE + insert into update_test_g values(1); + INSERT 0 1 + insert into update_test_g values(2); + INSERT 0 1 + select * from update_test_g; + a | b | c + ---+----------------------------+--- + 1 | 2022-06-27 14:09:19.004397 | + 2 | 2022-06-27 14:09:22.574669 | + (2 rows) + update update_test_g set a = 11 where a = 1; + UPDATE 1 + select * from update_test_g; + a | b | c + ----+----------------------------+---------------------------- + 2 | 2022-06-27 14:09:22.574669 | + 11 | 2022-06-27 14:09:36.574072 | 2022-06-27 14:09:36.574072 + (2 rows) + drop table update_test_g; + DROP TABLE + ``` + + - on update syntax: with tab as update query + + ```sql + create table update_test_h(a int, b timestamp default current_timestamp on update current_timestamp); + CREATE TABLE + insert into update_test_h values(1); + INSERT 0 1 + select * from update_test_h; + a | b + ---+---------------------------- + 1 | 2022-06-27 14:11:27.673113 + (1 row) + with tab as (update update_test_h set a=10 where a=1 returning 1) select * from tab; + ?column? + ---------- + 1 + (1 row) + select * from update_test_h; + a | b + ----+---------------------------- + 10 | 2022-06-27 14:11:34.761167 + (1 row) + drop table update_test_h; + DROP TABLE + ``` + + - on update syntax: prepare query + + ```sql + CREATE TABLE t2 (a int, b timestamp on update current_timestamp); + CREATE TABLE + INSERT INTO t2 VALUES(1); + INSERT 0 1 + select * from t2; + a | b + ---+--- + 1 | + (1 row) + PREPARE insert_reason(integer) AS UPDATE t2 SET a = $1; + PREPARE + EXECUTE insert_reason(52); + UPDATE 1 + select * from t2; + a | b + ----+---------------------------- + 52 | 2022-06-27 14:12:46.736842 + (1 row) + drop table t2; + DROP TABLE + ``` + + - on update syntax: single table query in stored procedure + + ```sql + create table t1(a int, b timestamp on update current_timestamp); + CREATE TABLE + insert into t1 values(1); + INSERT 0 1 + + CREATE OR REPLACE FUNCTION TEST1(val integer) + RETURNS VOID AS $$ + declare + val int; + begin + update t1 set a=val; + end; + $$ + LANGUAGE sql; + CREATE FUNCTION + CREATE OR REPLACE FUNCTION TEST2(val integer) + RETURNS integer AS $$ + update t1 set a=val; + select 1; + $$ + LANGUAGE sql; + CREATE FUNCTION + + select TEST2(11); + test2 + ------- + 1 + (1 row) + select * from t1; + a | b + ----+---------------------------- + 11 | 2022-06-27 14:15:44.620784 + (1 row) + select TEST1(2); + test1 + ------- + + (1 row) + select * from t1; + a | b + ---+---------------------------- + | 2022-06-27 14:15:52.286877 + (1 row) + DROP FUNCTION TEST1; + DROP FUNCTION + DROP FUNCTION TEST2; + DROP FUNCTION + drop table t1; + DROP TABLE + ``` + + - on update syntax: multiple table query in stored procedure + + ```sql + CREATE TABLE t1(a int, b timestamp DEFAULT current_timestamp on update current_timestamp); + CREATE TABLE + CREATE TABLE t2(a int, b timestamp DEFAULT current_timestamp, c varchar, d timestamp on update current_timestamp); + CREATE TABLE + CREATE TABLE t3(a int, b char, c timestamp on update current_timestamp, d text); + CREATE TABLE + INSERT INTO t1 VALUES(1); + INSERT 0 1 + INSERT INTO t2(a,c) VALUES(1,'test'); + INSERT 0 1 + INSERT INTO t3(a,b,d) VALUES(1,'T','asfdsaf'); + INSERT 0 1 + SELECT * FROM t1; + a | b + ---+---------------------------- + 1 | 2022-06-27 14:19:32.058004 + (1 row) + SELECT * FROM t2; + a | b | c | d + ---+---------------------------+------+--- + 1 | 2022-06-27 14:19:36.30913 | test | + (1 row) + SELECT * FROM t3; + a | b | c | d + ---+---+---+--------- + 1 | T | | asfdsaf + (1 row) + CREATE OR REPLACE FUNCTION test1(src int, dest int) RETURNS void AS $$ + BEGIN + UPDATE t1 SET a = dest WHERE a = src; + UPDATE t2 SET a = dest WHERE a = src; + UPDATE t3 SET a = dest WHERE a = src; + END; + $$ LANGUAGE PLPGSQL; + CREATE FUNCTION + SELECT test1(1,10); + test1 + ------- + + (1 row) + SELECT * FROM t1; + a | b + ----+---------------------------- + 10 | 2022-06-27 14:20:21.690661 + (1 row) + SELECT * FROM t2; + a | b | c | d + ----+---------------------------+------+---------------------------- + 10 | 2022-06-27 14:19:36.30913 | test | 2022-06-27 14:20:21.690892 + (1 row) + SELECT * FROM t3; + a | b | c | d + ----+---+----------------------------+--------- + 10 | T | 2022-06-27 14:20:21.691079 | asfdsaf + (1 row) + DROP FUNCTION test1; + DROP FUNCTION + DROP TABLE t1; + DROP TABLE + DROP TABLE t2; + DROP TABLE + DROP TABLE t3; + DROP TABLE + ``` + + - on update syntax: multiple table query with tab as update + + ```sql + CREATE TABLE t1(a int, b timestamp on update current_timestamp); + CREATE TABLE + CREATE TABLE t2(a int, b timestamp on update current_timestamp); + CREATE TABLE + INSERT INTO t1 VALUES(1); + INSERT 0 1 + INSERT INTO t2 VALUES(2); + INSERT 0 1 + SELECT * FROM t1; + a | b + ---+--- + 1 | + (1 row) + SELECT * FROM t2; + a | b + ---+--- + 2 | + (1 row) + with a as (update t1 set a=a+10 returning 1), b as (update t2 set a=a+10 returning 1) select * from a,b; + ?column? | ?column? + ----------+---------- + 1 | 1 + (1 row) + SELECT * FROM t1; + a | b + ----+---------------------------- + 11 | 2022-06-27 14:23:27.506413 + (1 row) + SELECT * FROM t2; + a | b + ----+---------------------------- + 12 | 2022-06-27 14:23:27.506413 + (1 row) + with a as (update t1 set a=a+10), b as (update t2 set a=a+10) select 1; + ?column? + ---------- + 1 + (1 row) + SELECT * FROM t1; + a | b + ----+---------------------------- + 21 | 2022-06-27 14:23:38.998855 + (1 row) + SELECT * FROM t2; + a | b + ----+---------------------------- + 22 | 2022-06-27 14:23:38.998855 + (1 row) + DROP TABLE t1; + DROP TABLE + DROP TABLE t2; + DROP TABLE + ``` + + - on update syntax: alter table query + + ```sql + CREATE TABLE t4(a int, b timestamp); + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------- + a | integer | + b | timestamp without time zone | + alter table t4 modify b timestamp on update current_timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------------------------- + a | integer | + b | timestamp without time zone | on update pg_systimestamp() + alter table t4 modify b timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------- + a | integer | + b | timestamp without time zone | + alter table t4 alter b set default now(); + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+--------------- + a | integer | + b | timestamp without time zone | default now() + alter table t4 alter b drop default; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------- + a | integer | + b | timestamp without time zone | + + alter table t4 alter b set default now(); + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+--------------- + a | integer | + b | timestamp without time zone | default now() + alter table t4 modify b timestamp on update current_timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+------------------------------------------- + a | integer | + b | timestamp without time zone | default now() on update pg_systimestamp() + alter table t4 alter b drop default; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------------------------- + a | integer | + b | timestamp without time zone | on update pg_systimestamp() + alter table t4 modify b timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------- + a | integer | + b | timestamp without time zone | + alter table t4 modify b timestamp on update current_timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------------------------- + a | integer | + b | timestamp without time zone | on update pg_systimestamp() + alter table t4 alter b set default now(); + ALTER TABLE + \d t4; + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+------------------------------------------- + a | integer | + b | timestamp without time zone | default now() on update pg_systimestamp() + alter table t4 modify b timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+--------------- + a | integer | + b | timestamp without time zone | default now() + alter table t4 alter b drop default; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------- + a | integer | + b | timestamp without time zone | + alter table t4 modify b timestamp on update current_timestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+----------------------------- + a | integer | + b | timestamp without time zone | on update pg_systimestamp() + alter table t4 modify b timestamp on update localtimestamp; + ALTER TABLE + \d t4 + Table "public.t4" + Column | Type | Modifiers + --------+-----------------------------+------------------------------------------------------ + a | integer | + b | timestamp without time zone | on update ('now'::text)::timestamp without time zone + ``` + + - on update syntax: like table including defaults + + ```sql + CREATE TABLE t5(id int, a timestamp default now() on update current_timestamp, b timestamp on update current_timestamp, c timestamp default now()); + CREATE TABLE + \d t5 + Table "public.t5" + Column | Type | Modifiers + --------+-----------------------------+------------------------------------------- + id | integer | + a | timestamp without time zone | default now() on update pg_systimestamp() + b | timestamp without time zone | on update pg_systimestamp() + c | timestamp without time zone | default now() + create table t6 (like t5 including defaults); + CREATE TABLE + \d t6 + Table "public.t6" + Column | Type | Modifiers + --------+-----------------------------+------------------------------------------- + id | integer | + a | timestamp without time zone | default now() on update pg_systimestamp() + b | timestamp without time zone | on update pg_systimestamp() + c | timestamp without time zone | default now() + ``` + +## Related Page + +[SQL Mode](../../reference-guide/guc-parameters/SQL-mode.md) \ No newline at end of file diff --git a/product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/whale.md b/product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/whale.md new file mode 100644 index 00000000..2256f7bf --- /dev/null +++ b/product/en/docs-mogdb/v3.0/reference-guide/oracle-plugins/whale.md @@ -0,0 +1,221 @@ +--- +title: whale +summary: whale +author: Zhang Cuiping +date: 2022-06-27 +--- + +# whale + +## Introduction + +whale is an Oracle compatibility extension package of MogDB, in which 15 Oracle functions and 7 packages are added. The functions include instrb, nls_charset_id, nls_charset_name, nls_lower, etc. The oracle packages include dbms_random, dbms_output, dbms_lock, dbms_application_info, dbms_metadata, dbms_job, and dbms_utility. + +> **Note**: The whale extension cannot be together used with the orafce extension. This issue will be resolved in the subsequent patch version. + +## whale Installation + +For details, see [gs_install_plugin](../../reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install_plugin.md) or [gs_install_plugin_local](../../reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install_plugin_local.md). + +## whale Usage + +Create the whale extension. + +```sql +CREATE EXTENSION whale; +``` + +> Note: After the extension is created and submitted, all existing connections that need to be reconnected can find whale functions without specifying the whale schema. + +### Function + +The Oracle packages currently supported include instrb, nls_charset_id, nls_charset_name, nls_lower, nls_upper, ora_hash, remainder, replace, show, show_parameter, to_timestamp, to_yminterval, tz_offset, nullif, and ratio_to_report. + +### Package + +Functions commonly used by users are stored in packages. To call certain functions, you can only specify a package to use them. + +Package is usually used in stored procedure. The following introduces dbms_random, dbms_output, dbms_lock, dbms_application_info, dbms_metadata, dbms_job, and dbms_utility. + +#### DBMS_RANDOM + +DBMS_RANDOM provides a built-in random data generator, including the following built-in interfaces: + +- DBMS_RANDOM.INITIALIZE(val IN BINARY_INTEGER): initializes a package. + + ```sql + select DBMS_RANDOM.INITIALIZE(101); + ``` + +- DBMS_RANDOM.NORMAL: returns random data in standard normal distribution. + + ```sql + select DBMS_RANDOM.NORMAL(); + ``` + +- DBMS_RANDOM.RANDOM: generates and returns a random integer ranging from -2^31 to 2^31. + + ```sql + select DBMS_RANDOM.RANDOM();s + ``` + +- DBMS_RANDOM.SEED: generates the seed of random data. + + ``` + select DBMS_RANDOM.SEED(1); + ``` + +- DBMS_RANDOM.STRING(opt IN CHAR,len IN NUMBER)RETURN VARCHAR2: generates and returns a random string. + + ```sql + select DBMS_RANDOM.STRING('A', 10); + select DBMS_RANDOM.STRING('x', 10); + ``` + + This function generates a random string in a specified mode. The optional modes are as follows: + + 'u' or 'U': returns only uppercase letters. + 'l' or 'L': returns only lowercase letters. + 'a' or 'A': returns a mixed string with uppercase and lowercase letters. + 'x' or 'X': returns a mixed string of uppercase letters and digits. + 'p' or 'P': returns any string that can be displayed. + +- DBMS_RANDOM.TERMINATE: This function has been discarded. It is supported but you are not advised to use it. It will be called after a package is finished. + +- DBMS_RANDOM.VALUE RETURN NUMBER: returns random data greater than or equal to 0 and less than 1. There are 15 places to the right of the decimal point. + +#### DBMS_OUTPUT + +DBMS_OUTPUT allows you to send information from a stored procedure, package, and trigger. DBMS_OUTPUT includes the following built-in interfaces: + +> **Note**: +> +> - DBMS_OUTPUT applies to only stored procedures and does not apply to gsql. +> +> - set serveroutput on is not supported. +> +> - set serveroutput off is not supported. + +- DBMS_OUTPUT.ENABLE(buffer_size IN INTEGER DEFAULT 20000): The greatest value of **buff_size** is 1000000 and the smallest value is 2000. Before using DBMS_OUTPUT, DBMS_OUTPUT.ENABLE must be executed. + +- DBMS_OUTPUT.GET_LINE(line INOUT text, status INOUT INTEGER): retrieves row arrays from the cache area. + +- DBMS_OUTPUT.GET_LINES(lines INOUT text[], numlines INOUT INTEGER): retrieves row arrays from the cache area. + + **Note**: After executing DBMS_OUTPUT.GET_LINE and DBMS_OUTPUT.GET_LINES, clear the cache area. + +- DBMS_OUTPUT.NEW_LINE: puts a space. +- DBMS_OUTPUT.PUT(item IN VARCHAR2): puts some rows in the cache area. +- DBMS_OUTPUT.PUT_LINE(item IN VARCHAR2): puts one row in the cache area. + +- DBMS_OUTPUT.disable (): clears the requested space. + +- DBMS_OUTPUT.data type: DBMS_OUTPUT package includes a built-in CHARARR data type. You can call DBMS_OUTPUT.CHARARR to use the data type. DBMS_OUTPUT package does not support the DBMSOUTPUT_LINESARRAY data type. + +#### DBMS_LOCK + +DBMS_LOCK provides an interface for the Oracle lock management service. + +#### DBMS_APPLICATION_INFO + +DBMS_APPLICATION_INFO is used for recording the name of a module or transaction being executed in a database so that the module performance can be traced and the module can be used in debugging. + +DBMS_APPLICATION_INFO includes the following built-in interfaces: + +- DBMS_APPLICATION_INFO.READ_CLIENT_INFO (client_info OUT VARCHAR2): reads the value of client_infor of the current session. + +- DBMS_APPLICATION_INFO.READ_MODULE (module_name OUT VARCHAR2, action_name OUT VARCHAR2): reads the module and the value of the related operation field of the current session. +- DBMS_APPLICATION_INFO.SET_CLIENT_INFO (client_info IN VARCHAR2): provides additional information related to client applications. +- DBMS_APPLICATION_INFO.SET_MODULE ( module_name IN VARCHAR2, action_name IN VARCHAR2): sets the name of the current application or module. + +- DBMS_APPLICATION_INFO.SET_ACTION (action_name IN VARCHAR2): sets the name of the current action under the current module. + +#### DBMS_METADATA + +DBMS_METADATA provides a method of creating and submitting a XML file including metadata retrieved from the database dictionary or creating DDL to recreate an object. + +#### DBMS_JOB + +DBMS_JOB calls and manages jobs in a job queue. + +DBMS_JOB includes the following built-in interfaces: + +- DBMS_JOB.BROKEN( job int8, broken bool, next_date timestamp default sysdate): sets the break marker. Broken indicates whether to terminate a job. To terminate a job, set its status (job_status) to d. +- DBMS_JOB.CHANGE( job int8, what text, next_date timestamp, "interval" text, instance int4 default null, force bool default false): modifies any fields that can be set in a job. + - At least one variable of what, next_date, and interval of CHANGE is not empty. If the parameter is not empty, it will not be modified. + - instance: is useless in dbms_job. + - force: is useless in dbms_job. + +- DBMS_JOB.INSTANCE( job int8, instance int4, force bool default false)(): does not perform any operation. + +- DBMS_JOB.INTERVAL( job int8, "interval" text): modifies the running frequency of a job. + +- DBMS_JOB.NEXT_DATE( job int8, next_date timestamp): modifies the running time of a job next time. + + **Note**: next_date is usually set to a time later than the current system time. If it is set to the current system time, the task will be executed at once and next_date will be set to the current system time plus interval. + +- DBMS_JOB.REMOVE(job int8): deletes a job from a job queue. +- DBMS_JOB.RUN( job int8, force boolean default false): runs a job. The force parameter is useless. + +- DBMS_JOB.SUBMIT( job out int8, what in text, next_date in timestamp default sysdate, "interval" in text default null, no_parse in bool default false, instance in int4 default null, force in bool default false): submits a new job. Parameters no_parse, instance, and force are not used. To use them, a prompt will be displayed. +- DBMS_JOB.USER_EXPORT(job IN int8, mycall OUT text): generates a call text to recreate a specified job. +- DBMS_JOB.WHAT( job int8, what text): modifies the job function and updates its environment. If what exists, an error will be reported. + +#### DBMS_UTILITY + +DBMS_UTILITY processes and calculates data types. It includes the following built-in interfaces: + +- DBMS_UTILITY.CANONICALIZE( name IN text, canon_name OUT text, canon_len IN int4): standardizes a given string. It processes a single reserved word or keyword, such as table, and clear the space of a single marker so that table will be changed to TABLE. + +- DBMS_UTILITY.COMMA_TO_TABLE( list IN text, tablen OUT int4, tab OUT text[]): replaces the list of names separated with commas with the PL/SQL table of the names. + +- DBMS_UTILITY.TABLE_TO_COMMA(tab IN text[], tablen OUT int4, val OUT text): converts the PL/SQL table of the names to the list of the names separated with commas. +- DBMS_UTILITY.DB_VERSION(INOUT version text, INOUT compatibility text): returns the database version. +- DBMS_UTILITY.EXEC_DDL_STATEMENT(IN parse_string text): executes the DDL statements in parse_string. + +The DBMS_UTILITY package supports the INSTANCE_RECORD, DBLINK_ARRAY, INDEX_TABLE_TYPE, INSTANCE_TABLE, LNAME_ARRAY, NAME_ARRAY, NUMBER_ARRAY, and UNCL_ARRAY data types. + +## Example + +### Function + +- INSTRB + + ```sql + MogDB=# select INSTRB('123456123', '123', 4); + instrb + -------- + 7 + (1 row) + ``` + +- NLS_CHARSET_ID + + ```sql + MogDB=# SELECT NLS_CHARSET_ID('gbk'); + nls_charset_id + ---------------- + 6 + (1 row) + ``` + +- dbms_random provides built-in random-number generator. + + ```sql + MogDB=# select DBMS_RANDOM.VALUE(1, '100'); + value + ------------------ + 92.4730090592057 + ``` + +### package + +The following uses dbms_random as an example. + +```sql +MogDB=# select DBMS_RANDOM.VALUE(); + value +------------------- + 0.482205999083817 +(1 row) +``` diff --git a/product/en/docs-ptk/v0.2/command.md b/product/en/docs-ptk/v0.2/command.md new file mode 100644 index 00000000..04926719 --- /dev/null +++ b/product/en/docs-ptk/v0.2/command.md @@ -0,0 +1,74 @@ +--- +title: PTK Command Reference +summary: PTK Command Reference +author: Yao Qian +date: 2022-06-28 +--- + +## PTK + +PTK is a command line tool for deploying and managing MogDB database clusters. + +## Syntax + +```shell +ptk [flags] [args...] +``` + +## Global Options + +Global options can be applied to any subcommand of PTK. + +### -f, --file string + +- Specifies the cluster configuration file. +- Data type: String +- During database installation, you need to specify the configuration file path by running the [ptk template](commands/ptk-template.md) command. + +### --log-file string + +- Specifies the file path to which the run log is stored. +- Data type: String +- The parameter is left blank by default. If this parameter is specified, PTK will export logs to a specified file. + +### --log-format string + +- Specifies the log export format. +- Data type: String +- The PTK log export format supports only `text` and `json`. +- Default value: **text** + +### --log-level string + +- Specifies the log export level. +- Data type: String +- The supported log level includes debug, info, warning, error, and panic. +- Default value: **info** + +### -v, --version + +- Displays the PTK version. +- Data type: Boolean +- Default value: **false** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## More Subcommands + +* [ptk candidate](commands/ptk-candidate.md) - Prints the list of software versions supported by PTK. +* [ptk checkos](commands/ptk-checkos.md) - Checks whether the cluster server dependencies meet the database installation requirements. +* [ptk encrypt](commands/ptk-encrypt.md) - Provides a quick method of encrypting your text or password. +* [ptk env](commands/ptk-env.md) - Prints PTK environment variables. +* [ptk install](commands/ptk-install.md) - Deploys the MogDB database cluster based on the given topology configuration. +* [ptk ls](commands/ptk-ls.md) - Lists all MogDB database clusters. +* [ptk self](commands/ptk-self.md) - Operates with the PTK installation package. +* [ptk cluster](commands/ptk-cluster.md) - Operates with the database cluster. +* [ptk template](commands/ptk-template.md) - Prints the configuration template. +* [ptk uninstall](commands/ptk-uninstall.md) - Uninstalls the MogDB database cluster. +* [ptk gen-om-xml](commands/ptk-gen-om-xml.md) - Generates the gs_om XML configuration file. +* [ptk version](commands/ptk-version.md) - Prints the PTK version. +* [ptk completion](commands/ptk-completion.md) - Generates an automatic completion script for a specified Shell. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-candidate-mogdb-server.md b/product/en/docs-ptk/v0.2/commands/ptk-candidate-mogdb-server.md new file mode 100644 index 00000000..fee111f0 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-candidate-mogdb-server.md @@ -0,0 +1,28 @@ +--- +title: ptk candidate mogdb-server +summary: ptk candidate mogdb-server +author: ptk +date: 2022-6-28 +--- + +## ptk candidate mogdb-server + +ptk candidate mogdb-server prints the list of the MogDB database versions supported by PTK. + +## Syntax + +```shell +ptk candidate mogdb-server [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs a table including the `software` and `version` fields. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-candidate-os.md b/product/en/docs-ptk/v0.2/commands/ptk-candidate-os.md new file mode 100644 index 00000000..255f1bf6 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-candidate-os.md @@ -0,0 +1,28 @@ +--- +title: ptk candidate os +summary: ptk candidate os +author: ptk +date: 2022-6-28 +--- + +## ptk candidate os + +Lists the operating systems supported for installing MogDB. + +## Syntax + +```shell +ptk candidate os [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs a table including the `software` and `version` fields. \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/commands/ptk-candidate.md b/product/en/docs-ptk/v0.2/commands/ptk-candidate.md new file mode 100644 index 00000000..e5bdc23d --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-candidate.md @@ -0,0 +1,33 @@ +--- +title: ptk candidate +summary: ptk candidate +author: ptk +date: 2022-6-28 +--- + +## ptk candidate + +ptk candidate prints the list of software versions supported by PTK and prints the list of the supported MogDB server versions by default. The function of ptk candidate is the same as that of [ptk candidate mogdb-server](ptk-candidate-mogdb-server.md). + +## Syntax + +```shell +ptk candidate [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs a table including the `software` and `version` fields. + +## Subcommand + +- [ptk candidate mogdb-server](ptk-candidate-mogdb-server.md) - Lists the supported MogDB database versions. +- [ptk candidate os](ptk-candidate-os.md) - Lists the OSs that support installation of MogDB. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-checkos.md b/product/en/docs-ptk/v0.2/commands/ptk-checkos.md new file mode 100644 index 00000000..73f4a4c9 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-checkos.md @@ -0,0 +1,96 @@ +--- +title: ptk checkos +summary: ptk checkos +author: ptk +date: 2022-6-28 +--- + +## ptk checkos + +ptk checkos checks whether the system parameters or dependencies of servers in a cluster meet database installation requirements. + +When the check result includes warnings or exceptions, PTK will automatically generate a shell repair script `root_fix_os.sh` in the current folder. The script includes suggested repair code for abnormal check items. You can copy the code to the terminal to execute it. + +**Note**: If multiple servers are deployed, the script includes repair suggestions of all servers. You need to copy the suggested code to the corresponding server for execution. + +PTK supports the following check items: + +- A1: Operating system version +- A2: Kernel version +- A3: Character set encoding +- A4: Time zone +- A5: Memory information +- A6: System control parameter +- A7: File system configuration +- A8: Disk configuration +- A9: Preread block size +- A10: IO scheduling configuration +- A11: NIC setting +- A12: Time clock consistency +- A13: Firewall status +- A14: Transparent huge page configuration +- A15: System dependencies +- A16: CPU command set + +All check items are checked by default. If you need to check certain check item, use `-i` to specify the specific item number. To specify multiple items, separate their item numbers with commas. + +## Syntax + +```shell +ptk checkos [flags] +``` + +## Option + +### -i, --item string + +- Specifies the check item. To specify multiple items, separate their item numbers with commas. +- Data type: String +- This option checks all check items by default. + +### -o, --output string + +- Specifies the file path for storing the check result. +- Data type: String +- This option is left blank by default. The check result is printed in the terminal window. + +### --detail + +- Displays details of each check item. +- Data type: Boolean +- This option is disabled by default and enabled by being added to the command line. + +### --only-abnormal-advice + +- Outputs repair suggestions for only abnormal errors. +- Data type: Boolean +- The option is disabled by default, includes warning and abnormal-related repair suggestions, and is enabled by being added to the command line. + +### --only-abnormal-detail + +- Displays only abnormal errors. +- Data type: Boolean +- The option is disabled by default, includes warning and abnormal-related errors, and is enabled by being added to the command line. + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs check process logs and the check result table. + +The check result is categorized into the following: + +- `Normal`: No operation is needed. +- `Warning`: needs to be processed as required. No processing does not influence installation and use. But it is not best practice. +- `Abnormal`: needs to be fixed according to the suggested script. Otherwise, the database may fail to be started. +- `ExecuteError`: Execution errors. It is recommended that it is reported to engineers for processing. + +The check result table includes the following fields: + +- Item: Check item name +- Level: Check result level +- (Message): This field is not displayed by default and is displayed by adding the `--detail` option. It displays detailed exceptions of different servers. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-cluster-restart.md b/product/en/docs-ptk/v0.2/commands/ptk-cluster-restart.md new file mode 100644 index 00000000..a06ce47b --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-cluster-restart.md @@ -0,0 +1,53 @@ +--- +title: ptk cluster restart +summary: ptk cluster restart +author: ptk +date: 2022-06-28 +--- + +## ptk cluster restart + +ptk cluster restart restarts a database cluster or instance. + +## Syntax + +```shell +ptk cluster restart -n string [flags] +``` + +## Option + +### -n, --name string + +- Specifies the name of the cluster to be operated with. +- Data type: String + +### -H, --host string + +- Specifies the IP address of the instance to be operated with. +- Data type: String +- This option supports querying the status of a single instance. It is used for querying the status of all instances in a cluster by default. + +### --security-mode string + +- Specifies whether to start the database in safe mode. +- Data type: String +- Values: **on** and **off** +- Default value: **off** + +### --time-out duration + +- Specifies the execution timeout duration. +- Data type: Duration +- The value unit can be h (hour), m (minute), s (second), and ms (millisecond). +- Default value: **2m** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs the run log. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-cluster-start.md b/product/en/docs-ptk/v0.2/commands/ptk-cluster-start.md new file mode 100644 index 00000000..afd11931 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-cluster-start.md @@ -0,0 +1,53 @@ +--- +title: ptk cluster start +summary: ptk cluster start +author: ptk +date: 2022-06-28 +--- + +## ptk cluster start + +ptk cluster start starts a databse cluster or instance. + +## Syntax + +```shell +ptk cluster start -n string [flags] +``` + +## Option + +### -n, --name string + +- Specifies the name of the cluster to be operated with. +- Data type: String + +### -H, --host string + +- Specifies the IP address of the instance to be operated with. +- Data type: String +- This option supports querying the status of a single instance. It is used for querying the status of all instances in a cluster by default. + +### --security-mode string + +- Specifies whether to start the database in safe mode. +- Data type: String +- Values: **on** and **off** +- Default value: **off** + +### --time-out duration + +- Specifies the execution timeout duration. +- Data type: Duration +- The value unit can be h (hour), m (minute), s (second), and ms (millisecond). +- Default value: **2m** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs the run log. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-cluster-status.md b/product/en/docs-ptk/v0.2/commands/ptk-cluster-status.md new file mode 100644 index 00000000..4241ba38 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-cluster-status.md @@ -0,0 +1,49 @@ +--- +title: ptk cluster status +summary: ptk cluster status +author: ptk +date: 2022-06-28 +--- + +## ptk cluster status + +ptk cluster status queries the running status of a database cluster or instance. + +## Syntax + +```shell +ptk cluster status -n string [flags] +``` + +## Option + +### -n, --name string + +- Specifies the name of the cluster to be operated with. +- Data type: String + +### -H, --host string + +- Specifies the IP address of the instance to be operated with. +- Data type: String +- This option supports querying the status of a single instance. It is used for querying the status of all instances in a cluster by default. + +### --detail + +- Specifies whether to display details. +- Data type: Boolean +- Default value: **false** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs the status by module. + +- Cluster State: specifies the cluster status. +- Datanode State: specifies the status of each instance node. +- (Datanode Detail): specifies the node details which is not output by default and displayed when you specify the `--detail` option. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-cluster-stop.md b/product/en/docs-ptk/v0.2/commands/ptk-cluster-stop.md new file mode 100644 index 00000000..a0f436cc --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-cluster-stop.md @@ -0,0 +1,46 @@ +--- +title: ptk cluster stop +summary: ptk cluster stop +author: ptk +date: 2022-06-28 +--- + +## ptk cluster stop + +ptk cluster stop stops a database cluster or instance. + +## Syntax + +```shell +ptk cluster stop -n string [flags] +``` + +## Option + +### -n, --name string + +- Specifies the name of the cluster to be operated with. +- Data type: String + +### -H, --host string + +- Specifies the IP address of the instance to be operated with. +- Data type: String +- This option supports querying the status of a single instance. It is used for querying the status of all instances in a cluster by default. + +### --time-out duration + +- Specifies the execution timeout duration. +- Data type: Duration +- The value unit can be h (hour), m (minute), s (second), and ms (millisecond). +- Default value: **2m** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs the run log. \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/commands/ptk-cluster.md b/product/en/docs-ptk/v0.2/commands/ptk-cluster.md new file mode 100644 index 00000000..2168406b --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-cluster.md @@ -0,0 +1,31 @@ +--- +title: ptk cluster +summary: ptk cluster +author: ptk +date: 2022-06-28 +--- + +## ptk cluster + +ptk cluster operates with database cluster management. + +## Syntax + +```shell +ptk cluster [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Subcommand + +- [ptk cluster status](ptk-cluster-status.md): Queries the cluster or instance status. +- [ptk cluster start](ptk-cluster-start.md): Starts a database cluster or instance. +- [ptk cluster stop](ptk-cluster-stop.md): Stops a database cluster or instance. +- [ptk cluster restart](ptk-cluster-restart.md): Restarts a database cluster or instance. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-completion-bash.md b/product/en/docs-ptk/v0.2/commands/ptk-completion-bash.md new file mode 100644 index 00000000..82677085 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-completion-bash.md @@ -0,0 +1,44 @@ +--- +title: ptk completion bash +summary: ptk completion bash +author: ptk +date: 2022-06-28 +--- + +## ptk completion bash + +ptk completion bash generates the automatic completion script of bash shell. + +The script depends on the bash-completion package. + +You can install the bash-completion package using the package manager of the operating system. + +Make the script take effect by running the command in the shell session. + +```shell +Source <(ptk completion bash) +```` + +Run the command in each session to make the script take effect. + +**Linux:** + +```shell +ptk completion bash > /etc/bash_completion.d/ptk +```` + +**macOS:** + +```shell +ptk completion bash > /usr/local/etc/bash_completion.d/ ptk +``` + +You need to start new shell to make the setting take effect. + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-completion-fish.md b/product/en/docs-ptk/v0.2/commands/ptk-completion-fish.md new file mode 100644 index 00000000..9488fc4f --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-completion-fish.md @@ -0,0 +1,32 @@ +--- +title: ptk completion fish +summary: ptk completion fish +author: ptk +date: 2022-06-28 +--- + +## ptk completion fish + +ptk completion fish generates the automatic completion script of fish. + +Make the script take effect by running the command in the shell session. + +```shell +ptk completion fish | source +``` + +Run the command in each session to make the script take effect. + +```shell +ptk completion fish > ~/.config/fish/completions/ptk.fish +``` + +You need to start new shell to make the setting take effect. + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-completion-powershell.md b/product/en/docs-ptk/v0.2/commands/ptk-completion-powershell.md new file mode 100644 index 00000000..974dec98 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-completion-powershell.md @@ -0,0 +1,26 @@ +--- +title: ptk completion powershell +summary: ptk completion powershell +author: ptk +date: 2022-06-28 +--- + +## ptk completion powershell + +ptk completion powershell generates the automatic completion script of powershell. + +Make the script take effect by running the command in the shell session. + +```powershell +ptk completion powershell | Out-String | Invoke-Expression +``` + +Run the command in each session to make the script take effect. Add the output of the above command to your powershell profile. + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-completion-zsh.md b/product/en/docs-ptk/v0.2/commands/ptk-completion-zsh.md new file mode 100644 index 00000000..681300e7 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-completion-zsh.md @@ -0,0 +1,46 @@ +--- +title: ptk completion zsh +summary: ptk completion zsh +author: ptk +date: 2022-06-28 +--- + +## ptk completion zsh + +ptk completion zsh generates the automatic completion script of zsh shell. + +If the shell completion function is not enabled, you can run the following command to enable it. + +```shell +echo "autoload -U compinit;compinit" >> ~/.zshrc +``` + +Make the script take effect by running the command in the shell session. + +```shell +source <(ptk completion zsh); compdef _ptk ptk +``` + +Run the command in each session to make the script take effect. + +**Linux:** + +```shell +ptk completion zsh > "${fpath[1]}/_ptk" +``` + +**macOS:** + +```shell +ptk completion zsh > /usr/local/share/zsh/site-functions/_ptk +``` + +You need to start new shell to make the setting take effect. + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-completion.md b/product/en/docs-ptk/v0.2/commands/ptk-completion.md new file mode 100644 index 00000000..1c434aaa --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-completion.md @@ -0,0 +1,27 @@ +--- +title: ptk completion +summary: ptk completion +author: ptk +date: 2022-06-28 +--- + +> Note: This command is not necessary. It is used for reference. + +## ptk completion + +ptk completion generates automatic PTK completion script for the specified Shell. For details about how to use the generated script, see the subcommands. + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Subcommand + +- [ptk completion bash](ptk-completion-bash.md): Generates the automatic completion script of bash. +- [ptk completion fish](ptk-completion-fish.md): Generates the automatic completion script of fish. +- [ptk completion powershell](ptk-completion-powershell.md): Generates the automatic completion script of powershell. +- [ptk completion zsh](ptk-completion-zsh.md): Generates the automatic completion script of zsh. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-encrypt.md b/product/en/docs-ptk/v0.2/commands/ptk-encrypt.md new file mode 100644 index 00000000..c6a6b614 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-encrypt.md @@ -0,0 +1,28 @@ +--- +title: ptk encrypt +summary: ptk encrypt +author: ptk +date: 2022-6-28 +--- + +## ptk encrypt + +ptk encrypt encrypts text or password. It is mainly used in encrypting the password field in a configuration file. It is recommended that a configuration file should store ciphertext instead of plain text. + +## Syntax + +```shell +ptk encrypt TEXT1 [TEXT2 TEXT3...] [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs original content and ciphertext in the key-value format. If multiple passwords are encrypted, they are output in multiple lines. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-env.md b/product/en/docs-ptk/v0.2/commands/ptk-env.md new file mode 100644 index 00000000..fe15d829 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-env.md @@ -0,0 +1,28 @@ +--- +title: ptk env +summary: ptk env +author: ptk +date: 2022-06-28 +--- + +## ptk env + +ptk env prints PTK environment variables. + +## Syntax + +```shell +ptk env [key1 key2 ... keyN] [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs values of environment variables in the key-value format. \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/commands/ptk-gen-om-xml.md b/product/en/docs-ptk/v0.2/commands/ptk-gen-om-xml.md new file mode 100644 index 00000000..f1034807 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-gen-om-xml.md @@ -0,0 +1,30 @@ +--- +title: ptk gen-om-xml +summary: ptk gen-om-xml +author: ptk +date: 2022-06-28 +--- + +## ptk gen-om-xml + +ptk gen-om-xml generates an XML configuration file used by gs_om. + +## Syntax + +```shell +ptk gen-om-xml -f CONFIG_FILE [flags] +``` + +## Option + +### -o, --output string + +- Specifies the file path. +- Data type: String +- Default value: `config_[timestamp].xml` + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-install.md b/product/en/docs-ptk/v0.2/commands/ptk-install.md new file mode 100644 index 00000000..1403dad1 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-install.md @@ -0,0 +1,149 @@ +--- +title: ptk install +summary: ptk install +author: ptk +date: 2022-6-28 +--- + +## ptk install + +ptk install deploys a MogDB database cluster based on the given topology configuration. + +## Syntax + +```shell +ptk install -f CONFIG_YAML [flags] +``` + +## Option + +### -y, --assumeyes + +- Automatically replies yes for all questions. +- Data type: Boolean +- This option is disabled by default. It takes effect by being added to the command line. +- Default value: **false** + +### --db-version string + +- Specifies the database version (only support for online installation) +- Data type: String +- You can run the `ptk candidate mogdb-server` command to query the supported MogDB server version list. +- Default value: **3.0.0** + +### -e, --env strings + +- Specifies the environment variable string in the key-value format. All values are added to environment variables of the system user after installation. +- Data type: String list +- This option can be specified for multiple times and its value varies each time. + +### -p, --pkg string + +- Specifies the file path or download address of a database installation package. +- Data type: String +- This option is left blank by default. The installation package corresponding to the default value of `--db-version` is used. The option supports local disk file path and also network download path (including `http://` or `https://`). + +### --no-cache + +- Specifies that the installation package in the local cache is not used. +- Data type: Boolean +- This option is disabled by default. PTK checks whether there is a cached installation package in the local metadata. If there is an installation package, it will be used for installation. +- Default value: **false** + +### --launch-db-timeout duration + +- Specifies the database start timeout duration. +- Data type: Duration +- If the database start time exceeds the specified timeout duration, a timeout error is reported. You need to manually check the database start status or manually start the database. +- The value unit can be h (hour), m (minute), s (second), and ms (millisecond). +- Default value: **1m** + +### --pre-run string + +- Specifies the path for storing the bash script to be executed before installing a database. +- Data type: String +- This option provides the pre-hook function, which allows you to provide a bash script. PTK will run the script on each server in a cluster before database deployment. + +### --post-run string + +- Specifies the path for storing the bash script to be executed after starting a database. +- Data type: String +- This option provides the post-hook function, which allows you to provide a bash script. PTK will run the script on each server in a cluster after database start. + +### --skip-check-distro + +- Skips the check of operating system release version. +- Data type: Boolean +- This option is disabled by default and takes effect after being added to the command line. It is usually used in test scenarios. It can be used for testing a database on an operating system that PTK does not support. +- Default value: **false** + +### --skip-check-os + +- Skips the check of system environment. +- Data type: Boolean +- This option is disabled by default and takes effect after being added to the command line. When you cannot modify system parameters due to some reasons, PTK supports skipping this check item to install a database directly. However, once the check result is abnormal, the installation will terminate. +- Default value: **false** + +### --skip-create-user + +- Skips the creation of a system user. +- Data type: Boolean +- This option is disabled by default and takes effect after being added to the command line. When this option is specified, make sure that the user of the server where a database is installed exists. Otherwise, the installation will terminate. +- Default value: **false** + +### --install-cm + +- Installs CM-related components (this option takes effect in the scenario where at least 3 nodes are deployed). + +- Data type: Boolean + +- This option is disabled by default and takes effect after being added to the command line. The CM component provides HA and operation and maintenance capabilities. When you choose other HA components, PTK supports CM component that is not installed by default and starts the primary and standby databases using gs_ctl. + + **Note**: PTK manages database instances using gs_ctl, therefore the start and stop functions are not supported temporarily when the CM component is installed. + +- Default value: **false** + +### --skip-launch-db + +- Skips database start upon completion of installation. +- Data type: Boolean +- This option is disabled by default and takes effect after being added to the command line. When this option is specified for installation and you manually start the database again, you need to change the initial password. Otherwise, error `ERROR: Please use "ALTER ROLE user_name PASSWORD 'password';" to set the password of user xx before other operation!` will be reported when you check the cluster status by running [ptk cluster status](ptk-cluster-status.md). +- Default value: **false** + +### --skip-rollback + +- Skips rollback once an error occurs during installation. +- Data type: Boolean +- This option is disabled by default and takes effect after being added to the command line. PTK will roll back all operations once an error occurs during installation by default to make sure that no file or configuration is left in the system. This operation depends on the network, therefore make sure that the SSH connection is normal. If the network is disconnected or other error occurs, rollback will terminate and you need to manually clear the system environment. +- Default value: **false** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Displays installation log. The default log level is INFO. You can modify the log level by specifying the global parameter `--log-level`. + +Outputs installation status table, including the following fields: + +- host: server IP address +- stage: installation stage +- status: installation status +- message: installation result information + +Installation status: + +- precheck_success: Precheck is successful. +- precheck_failed: Precheck failed. +- initial_db_success: Database initialization is successful. +- initial_db_failed: Database initialization failed. +- initial_cm_success: CM component initialization is successful. +- initial_cm_failed: CM component initialization failed. +- rollback_success: Rollback is successful. +- need_rollback_manually: You need to manually perform rollback operations. +- start_success: The database is started successfully. +- start_failed: The database failed to be started. +- need_start_manually: You need to manually start the database. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-ls.md b/product/en/docs-ptk/v0.2/commands/ptk-ls.md new file mode 100644 index 00000000..75cf8b43 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-ls.md @@ -0,0 +1,41 @@ +--- +title: ptk ls +summary: ptk ls +author: ptk +date: 2022-06-28 +--- + +## ptk ls + +ptk ls lists all databases installed. Different users can see only their own databases. + +## Syntax + +```shell +ptk ls [flags] +``` + +## Option + +### -n, --only-name + +- Lists only the cluster name. +- Data type: Boolean +- This option is disabled by default. It displays the static data of a cluster. It takes effect by being added to the command line. +- Default value: **false** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs a cluster list, which includes the following fields: + +- cluster_name: Cluster name +- instances: Instances in a cluster +- user: Operating system user +- data_dir: Data directory of an instance +- db_version: Database version diff --git a/product/en/docs-ptk/v0.2/commands/ptk-self-upgrade.md b/product/en/docs-ptk/v0.2/commands/ptk-self-upgrade.md new file mode 100644 index 00000000..1ce3dc98 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-self-upgrade.md @@ -0,0 +1,24 @@ +--- +title: ptk self upgrade +summary: ptk self upgrade +author: ptk +date: 2022-06-28 +--- + +## ptk self upgrade + +ptk self upgrade downloads and automatically installs PTK of the latest version. + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs the upgrade operation log, including the package of the latest version and performs the upgrade. When `upgrade ptk successfully` is displayed, the upgrade is successful. + +You can run the [ptk version](ptk-version.md) command to query the version after the upgrade. \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/commands/ptk-self.md b/product/en/docs-ptk/v0.2/commands/ptk-self.md new file mode 100644 index 00000000..e6266e31 --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-self.md @@ -0,0 +1,29 @@ +--- +title: ptk self +summary: ptk self +author: ptk +date: 2022-06-28 +--- + +## ptk self + +ptk self prints PTK environment variables. + +## Syntax + +```shell +ptk self [command] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Subcommand + +[ptk self upgrade](ptk-self-upgrade.md): PTK upgrade + diff --git a/product/en/docs-ptk/v0.2/commands/ptk-template-create.md b/product/en/docs-ptk/v0.2/commands/ptk-template-create.md new file mode 100644 index 00000000..d2ebd32a --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-template-create.md @@ -0,0 +1,30 @@ +--- +title: ptk template create +summary: ptk template create +author: ptk +date: 2022-6-28 +--- + +## ptk template create + +ptk template create creates a configuration template in an interactive way. + +## Syntax + +```shell +ptk template create [flags] +``` + +## Option + +### -o, --output string + +- Specifies the file path for storing a template. +- Data type: String +- Default value: **config.yaml** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-template.md b/product/en/docs-ptk/v0.2/commands/ptk-template.md new file mode 100644 index 00000000..0e2b0dfd --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-template.md @@ -0,0 +1,71 @@ +--- +title: ptk template +summary: ptk template +author: ptk +date: 2022-6-28 +--- + +## ptk template + +ptk template prints a configuration template, and outputs a configuration template of multiple instances. + +## Syntax + +```shell +ptk template [flags] +``` + +## Option + +### -l, --local + +- Generates the configuration file of the local single-instance database. +- Data type: Boolean +- The option is disabled by default. It takes effect by being added to the command line. +- Default value: **false** + +### -d, --base-dir string + +- Specifies the root directory of the database to be installed. +- Data type: String +- PTK automatically creates data, tool, and application directories for the database to be installed in this root directory. +- Default value: **/opt/mogdb** + +### -n, --cluster-name string + +- Specifies the cluster name. +- Data type: String +- If this parameter is not specified, PTK will generate a cluster name in random by default. + +### -u, --user string + +- Specifies the system user name for running a database. +- Data type: String +- Default value: **omm** + +### -g, --group string + +- Specifies the system user group name for running a database. +- Data type: String +- Default value: The default value is the same as the system user name specified by `-u`. + +### -p, --port int + +- Specifies the database port. +- Data type: Integer +- Default value: **26000** + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +Outputs original content and ciphertext in the key-value format. If multiple passwords are encrypted, they are output in multiple lines. + +## Subcommand + +- [ptk template create][ptk-template-create.md] + diff --git a/product/en/docs-ptk/v0.2/commands/ptk-uninstall.md b/product/en/docs-ptk/v0.2/commands/ptk-uninstall.md new file mode 100644 index 00000000..fbab54fe --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-uninstall.md @@ -0,0 +1,44 @@ +--- +title: ptk uninstall +summary: ptk uninstall +author: ptk +date: 2022-06-28 +--- + +## ptk uninstall + +ptk uninstall uninstalls a MogDB database cluster. + +## Syntax + +```shell +ptk uninstall [flags] +``` + +## Option + +### -n, --name string + +- Specifies the name of the cluster to be uninstalled. +- Data type: String +- You need to specify one of this option and the global option `-f` to tell the target cluster to be uninstalled. + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Example + +```shell +# Uninstall a database by specifying a configuration file +ptk uninstall -f config.yaml + +# Uninstall a database by specifying a cluster name +ptk uninstall --name CLUSTER_NAME +``` + +## Output + +Outputs the uninstallation operation log. diff --git a/product/en/docs-ptk/v0.2/commands/ptk-version.md b/product/en/docs-ptk/v0.2/commands/ptk-version.md new file mode 100644 index 00000000..11ec4b9b --- /dev/null +++ b/product/en/docs-ptk/v0.2/commands/ptk-version.md @@ -0,0 +1,37 @@ +--- +title: ptk version +summary: ptk version +author: ptk +date: 2022-06-28 +--- + +## ptk version + +ptk version prints the PTK version. + +## Syntax + +```shell +ptk version [flags] +``` + +## Option + +### -h, --help + +- Outputs the help information. +- Data type: Boolean +- This option is disabled by default. The default value is **false**. This function can be enabled by adding the option to the command or adding the option and its value **true** to the command. + +## Output + +The version information is similar to the following. + +```text +PTK Version: v0.2.0 +Go Version: go1.17.1 +Build Date: 2022-06-28T07:28:33Z +Git Hash: df42c22 +``` + +The output includes the PTK version, Golang version in compilation, build time, and git commit information. diff --git a/product/en/docs-ptk/v0.2/config.md b/product/en/docs-ptk/v0.2/config.md new file mode 100644 index 00000000..3b9b2029 --- /dev/null +++ b/product/en/docs-ptk/v0.2/config.md @@ -0,0 +1,782 @@ +--- +title: Configuration File +summary: Configuration File +author: Yao Qian +date: 2021-09-14 +--- + +# Configuration File + +This document introduces all configuration parameters required for cluster installation. + +To install a database cluster, you need to provide a configuration file used for describing the cluster topology. It will be used in most PTK subcommands. + +PTK provides an interactive way of creating a configuration file. You can run the following command to enter the interactive process. + +```shell +ptk template create +``` + +After finishing configuration according to the terminal prompts, a `config.yaml` file will generate in the current folder. + +Additionally, if you do not need to create a configuration file in the interactive way, run the following command to generate a default configuration file `config.yaml`. You need to configure parameters based on actual requirements. + +```shell +ptk template > config.yaml +``` + +When you do not create the configuration file in an interactive way, you are advised to encrypt the system user password, database password, SSH password, or key password by running the PTK encryption command before writing the password into the configuration file. + + + +```shell +ptk encrypt PASSWORD +``` + +--- + +## Configuration + +The following shows how to configure database cluster topology information. + +**Example**: + +- Simple configuration + +```yaml +# Cluster configuration information, in which db_port and ssh_option are reusable fields +global: + cluster_name: DefaultCluster # Cluster name that is the unique identifier of a cluster + db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts. +# Configuration information of database instance servers in a cluster +db_servers: + - host: 10.1.1.100 # IP address of the database instance server (only supporting IPv4) + - host: 10.1.1.101 # IP address of the database instance server (only supporting IPv4) +``` + +- Complex configuration + +```yaml +# Cluster configuration information, in which db_port and ssh_option are reusable fields +global: + cluster_name: CustomCluster # Cluster name that is the unique identifier of a cluster + user: omm # System username for running a database + group: omm # System user group for running a database + db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts. + base_dir: /opt/mogdb # Base directory of database installation. If it is not configured in app_dir, data_dir, log_dir, and tool_dir, PTK will create these directories in the current directory. +# Configuration information of database instance servers in a cluster +db_servers: + - host: 10.1.1.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.1.101 + - 10.1.1.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: primary # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + az_name: BJ # AZ name + az_priority: 1 # AZ priority. The lower the value, the higher the priority. + - host: 10.1.2.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.2.101 + - 10.1.2.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: standby # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + az_name: BJ # AZ name + az_priority: 1 # AZ priority. The lower the value, the higher the priority. + - host: 10.1.2.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.2.101 + - 10.1.2.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: cascade_standby # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + upstream_host: 10.1.2.100 # When the instance role is cascade_standby, this field indicates the IP address of the upstream standby server. + az_name: SH # AZ name + az_priority: 2 # AZ priority. The lower the value, the higher the priority. +``` + +### Global + +**Data type**: Global + +**Description**: Cluster configuration information, in which `db_port` and `ssh_option` are **reusable fields**.

**Reusable fields** + +- If this field is set in instance-level configuration, the instance-level configuration prevails. +- If this field is not set in instance-level configuration, the global-level configuration prevails. + +**Example**: + +- Simple global example + +```yaml +global: + cluster_name: DefaultCluster # Cluster name that is the unique identifier of a cluster + db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts. +``` + +- Complex global example + +```yaml +global: + cluster_name: CustomCluster # Cluster name that is the unique identifier of a cluster + user: omm # System username for running a database + group: omm # System user group for running a database + db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts. + base_dir: /opt/mogdb # Base directory of database installation. If it is not configured in app_dir, data_dir, log_dir, and tool_dir, PTK will create these directories in the current directory. +``` + +**Added in**: v0.1 + +### db_servers + +**Data type**: DBServer + +**Description**: Configuration information of database instance servers in a cluster + +**Example**: + +- Simple database server example + +```yaml +db_servers: + - host: 10.1.1.100 # IP address of the database instance server (only supporting IPv4) + - host: 10.1.1.101 # IP address of the database instance server (only supporting IPv4) +``` + +- Complex database server example + +```yaml +db_servers: + - host: 10.1.1.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.1.101 + - 10.1.1.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: primary # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + az_name: BJ # AZ name + az_priority: 1 # AZ priority. The lower the value, the higher the priority. + - host: 10.1.2.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.2.101 + - 10.1.2.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: standby # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + az_name: BJ # AZ name + az_priority: 1 # AZ priority. The lower the value, the higher the priority. + - host: 10.1.2.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.2.101 + - 10.1.2.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: cascade_standby # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + upstream_host: 10.1.2.100 # When the instance role is cascade_standby, this field indicates the IP address of the upstream standby server. + az_name: SH # AZ name + az_priority: 2 # AZ priority. The lower the value, the higher the priority. +``` + +**Added in**: v0.1 + +--- + +## Global + +Global defines global parameters in a configuration file. + +Appears in: + +- Config.global + +**Example**: + +- Simple global example + +```yaml +cluster_name: DefaultCluster # Cluster name that is the unique identifier of a cluster +db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts. +``` + +- Complex global example + +```yaml +cluster_name: CustomCluster # Cluster name that is the unique identifier of a cluster +user: omm # System username for running a database +group: omm # System user group for running a database +db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts. +base_dir: /opt/mogdb # Base directory of database installation. If it is not configured in app_dir, data_dir, log_dir, and tool_dir, PTK will create these directories in the current directory. +``` + +### cluster_name + +**Data type**: String + +**Description**: Cluster name that is the unique identifier of a cluster + +**Example**: + +- Cluster name example + +```yaml +cluster_name: cluster1 +``` + +**Added in**: v0.1 + +### user + +**Data type**: String + +**Description**: System username for running a database
The default value is **omm**. + +**Example**: + +- OS user example + +```yaml +user: omm +``` + +**Added in**: v0.1 + +### group + +**Data type**: String + +**Description**: System user group for running a database
The value is the same as the system username by default. + +**Example**: + +- OS user group example + +```yaml +group: omm +``` + +**Added in**: v0.1 + +### user_password + +**Data type**: String + +**Description**: System user password for running a database
The value can be displayed in plain text and ciphertext. It is recommended that the value is encrypted by running `ptk encrypt`.
This field is left blank by default. + +**Added in**: v0.1 + +### db_password + +**Data type**: String + +**Description**: Initial database user password. If this password is not specified in the configuration file, it needs to be entered during database installation according to the terminal prompts.
The value can be displayed in plain text and ciphertext. It is recommended that the value is encrypted by running `ptk encrypt`. + +**Added in**: v0.1 + +### db_port + +**Data type**: Int + +**Description**: Database port
The default value is **26000**. + +**Example**: + +- Database port example + +```yaml +db_port: 26000 +``` + +**Added in**: v0.1 + +### base_dir + +**Data type**: String + +**Description**: Base directory of database installation. If it is not configured in app_dir, data_dir, log_dir, and tool_dir, PTK will create these directories in the current directory.
The default value is **/opt/mogdb**. + +**Example**: + +- Database base directory example + +```yaml +base_dir: /opt/mogdb +``` + +**Added in**: v0.1 + +### app_dir + +**Data type**: String + +**Description**: Directory for storing database deployment file, startup script, and configuration file
The default value is **/opt/mogdb/app**. + +**Example**: + +- Database app directory example + +```yaml +app_dir: /opt/mogdb/app +``` + +**Added in**: v0.1 + +### data_dir + +**Data type**: String + +**Description**: Data directory of a database
The default value is **/opt/mogdb/data**. + +**Example**: + +- Database data directory example + +```yaml +data_dir: /opt/mogdb/data +``` + +**Added in**: v0.1 + +### log_dir + +**Data type**: String + +**Description**: Directory for storing database run logs and operation logs
The default value is **/opt/mogdb/log**. + +**Example**: + +- Database log directory example + +```yaml +log_dir: /opt/mogdb/log +``` + +**Added in**: v0.1 + +### tool_dir + +**Data type**: String + +**Description**: Database tool directory
The default value is **/opt/mogdb/tool**. + +**Example**: + +- Database tool directory example + +```yaml +tool_dir: /opt/mogdb/tool +``` + +**Added in**: v0.1 + +### tmp_dir + +**Data type**: String + +**Description**: Temporary directory of a database
The default value is **/tmp**. + +**Example**: + +- Temporary directory example + +```yaml +tmp_dir: /tmp +``` + +**Added in**: v0.1 + +### core_file_dir + +**Data type**: String + +**Description**: Directory for storing error log files when core dump occurs. After this field is configured, system configuration parameter `kernel.core_pattern` will be modified accordingly.
This field is left blank by default. + +**Added in**: v0.1 + +### cm_dir + +**Data type**: String + +**Description**: Directory for storing database CM data (This field takes effect in MogDB 3.0 or later) + +**Example**: + +- Database CM directory example + +```yaml +cm_dir: /opt/mogdb/cm +``` + +**Added in**: v0.2 + +### cm_server_port + +**Data type**: Int + +**Description**: CM server port (This field takes effect in MogDB 3.0 or later)
**Example**:
name: cm server port
value: 15300
+ +**Added in**: v0.2 + +### ssh_option + +**Data type**: SSHOption + +**Description**: SSH login information. The login user needs to be **root** or has sudo permission.
If this field is not configured. The database is installed on the local server where PTK is located. + +**Added in**: v0.1 + +--- + +## DBServer + +Configuration information of database instance servers in the DBServer cluster + +Appears in: + +- Config.db_servers + +**Example**: + +- Simple database server example + +```yaml +- host: 10.1.1.100 # IP address of the database instance server (only supporting IPv4) +- host: 10.1.1.101 # IP address of the database instance server (only supporting IPv4) +``` + +- Complex database server example + +```yaml +- host: 10.1.1.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.1.101 + - 10.1.1.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: primary # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + az_name: BJ # AZ name + az_priority: 1 # AZ priority. The lower the value, the higher the priority. +- host: 10.1.2.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.2.101 + - 10.1.2.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: standby # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + az_name: BJ # AZ name + az_priority: 1 # AZ priority. The lower the value, the higher the priority. +- host: 10.1.2.100 # IP address of the database instance server (only supporting IPv4) + db_port: 27000 # Database port + # Log transfer IP addresses of primary/standby database instances + ha_ips: + - 10.1.2.101 + - 10.1.2.102 + ha_port: 27001 # Log transfer port of primary/standby database instances + role: cascade_standby # Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + upstream_host: 10.1.2.100 # When the instance role is cascade_standby, this field indicates the IP address of the upstream standby server. + az_name: SH # AZ name + az_priority: 2 # AZ priority. The lower the value, the higher the priority. +``` + +### host + +**Data type**: String + +**Description**: IP address of the database instance server (only supporting IPv4) + +**Example**: + +- Database server IP address example + +```yaml +host: 10.1.1.100 +``` + +**Added in**: v0.1 + +### db_port + +**Data type**: Int + +**Description**: Database port
The field is left blank by default. The global port 26000 is reused. + +**Example**: + +- Database port example + +```yaml +db_port: 26000 +``` + +**Added in**: v0.1 + +### ha_ips + +**Data type**: String + +**Description**: Log transfer IP addresses of primary/standby database instances
The HA IP address is the same as the server IP address by default. + +**Example**: + +- Database HA IP address list example + +```yaml +ha_ips: + - 10.1.1.100 +``` + +**Added in**: v0.1 + +### ha_port + +**Data type**: Int + +**Description**: Log transfer port of primary/standby database instances
The HA port is the same as the database port by default. + +**Added in**: v0.1 + +### role + +**Data type**: String + +**Description**: Database instance role. If it is not specified, PTK will choose an instance randomly to make it a primary instance and the others will be standby instances. + +**Optional values**: + +- primary +- standby +- cascade_standby + +**Example**: + +- Database role example + +```yaml +role: primary +``` + +**Added in**: v0.1 + +### upstream_host + +**Data type**: String + +**Description**: When the instance role is cascade_standby, this field indicates the IP address of the upstream standby server. + +**Example**: + +- Cascaded database upstream server example + +```yaml +upstream_host: 10.1.1.101 +``` + +**Added in**: v0.1 + +### az_name + +**Data type**: String + +**Description**: AZ name
The default value is **AZ1**. + +**Example**: + +- Database AZ example + +```yaml +az_name: AZ1 +``` + +**Added in**: v0.1 + +### az_priority + +**Data type**: Int + +**Description**: AZ priority. The lower the value, the higher the priority.
The default value is **1**. + +**Added in**: v0.1 + +### xlog_dir + +**Data type**: String + +**Description**: Directory for storing database Xlog
This field is left blank by default. If this field is configured, the value cannot be the subdirectory of the data directory. + +**Added in**: v0.1 + +### db_conf + +**Data type**: map[string]string + +**Description**: You can configure the database parameters as you need. This field configuration information will be written into the postgresql.conf file before the database is started. + +**Example**: + +- Database configuration example + +```yaml +db_conf: + key: value +``` + +**Added in**: v0.1 + +### ssh_option + +**Data type**: SSHOption + +**Description**: SSH login information. The login user needs to be **root** or has sudo permission.
If this field is not configured. The database is installed on the local server where PTK is located. + +**Added in**: v0.1 + +--- + +## SSHOption + +SSHOption SSH login supports password and key authentication. You need to choose at least one. + +Appears in: + +- Global.ssh_option +- DBServer.ssh_option +- SSHOption.proxy + +**Example**: + +```yaml +host: 10.1.1.100 +port: 22 +user: root +key_file: ~/.ssh/id_rsa +``` + +### host + +**Data type**: String + +**Description**: IP address of the target server to be connected
This field is mandatory when the host works as a jump server.
When the server has the database installed, this field can be left blank. The IP address of db_server will be used.
This field is left blank by default. + + + +**Added in**: v0.1 + +### port + +**Data type**: Int + +**Description**: SSH service port
The default value is **22**. + +**Added in**: v0.1 + +### user + +**Data type**: String + +**Description**: SSH login user
The default value is **root**. + +**Example**: + +- SSH user example + +```yaml +user: root +``` + +**Added in**: v0.1 + +### password + +**Data type**: String + +**Description**: SSH login user password
The value can be displayed in plain text and ciphertext. It is recommended that the value is encrypted by running `ptk encrypt`. + +**Example**: + +- SSH password example + +```yaml +password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= +``` + +**Added in**: v0.1 + +### key_file + +**Data type**: String + +**Description**: Directory for storing SSH login key files
This field is left blank by default. + +**Example**: + +- SSH key file example + +```yaml +key_file: ~/.ssh/id_rsa +``` + +**Added in**: v0.1 + +### passphrase + +**Data type**: String + +**Description**: SSH login key file password
The value can be displayed in plain text and ciphertext. It is recommended that the value is encrypted by running `ptk encrypt`.
This field is left blank by default. + +**Added in**: v0.1 + +### conn_timeout + +**Data type**: Duration + +**Description**: SSH login connection timeout duration. The value unit can be minute or second.
The default value is **1m**. + +**Example**: + +- SSH connection timeout example + +```yaml +conn_timeout: 1m +``` + +```yaml +conn_timeout: 30s +``` + +**Added in**: v0.1 + +### exec_timeout + +**Data type**: Duration + +**Description**: Timeout duration for executing a single command in SSH mode
The default value is **1m**. + +**Example**: + +- SSH execution timeout example + +```yaml +exec_timeout: 1m +``` + +```yaml +exec_timeout: 30s +``` + +**Added in**: v0.1 + +### proxy + +**Data type**: SSHOption + +**Description**: Jump server login information. If the target server cannot be connected directly, you can use a jump server for connection. q + +**Added in**: v0.1 diff --git a/product/en/docs-ptk/v0.2/debug.md b/product/en/docs-ptk/v0.2/debug.md new file mode 100644 index 00000000..1e92a6af --- /dev/null +++ b/product/en/docs-ptk/v0.2/debug.md @@ -0,0 +1,36 @@ +--- +title: Troubleshooting +summary: Troubleshooting +author: Yao Qian +date: 2022-05-30 +--- + +## Troubleshooting + +### Error Code Starting with 40xx + +Error code starting with 40XX, such as `PTK-4030` indicates that data in the configuration file is incorrect. You need to modify related information according to the prompt information in the error code and then run the command. + +### Error Code Starting with 50xxx + +Error code starting with 50XX, such as `PTK-50000` indicates that the error occurs during PTK running. + +The specific categories are as follows. + +```wiki +- 500XX Program error or unknown error +- 501XX Cluster and metadata error +- 502XX File or folder error +- 503XX System user or group error +- 504XX Disk error +- 505XX Memory error +- 506XX Network error +- 507XX Firewall error +- 508XX Other system error +- 509XX gs_ctl operation error +- 510XX Environment variable error +``` + +You can query the related system or running parameters as required. + +If a program crashes or there are bugs, report them to PTK developers for fixing or upgrade. \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/faq.md b/product/en/docs-ptk/v0.2/faq.md new file mode 100644 index 00000000..ada86e9f --- /dev/null +++ b/product/en/docs-ptk/v0.2/faq.md @@ -0,0 +1,30 @@ +--- +title: FAQ +summary: FAQ +author: Yao Qian +date: 2022-05-30 +--- + +## FAQ + +### Can Multiple Instances Be Deployed on a Single Server? + +One server supports deployment of multiple database instances. The database depends on environment variables, therefore different system users need to be defined during database configuration to isolate environment variables. + +### Is gs_om Supported After PTK Is Installed? + +Yes. The database cluster installed using PTK is compatible with gs_om because the `cluster_static_config` and `upgrade_version` files required by gs_om are generated during automatic installation using PTK. + +> **Note**: `gs_om` requires user mutual-trust which needs to be configured. + +### How Can I Query the Supported Versions of MogDB Using PTK? + +You can run the `ptk candidate mogdb-server` command. + +### What Should I Do If Error `FATAL: semctl(578486307, 7, SETVAL, 0) failed: Invalid argument` Is Reported During `gs_ctl query` + +Check the value of **RemoveIPC** in the `/etc/systemd/logind.conf` file. Make sure that the value is **no** and then restart the server. + +### How Can I Query the Supported Operating Systems for Installing MogDB Using PTK? + +You can run the `ptk candidate os` command. \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/install.md b/product/en/docs-ptk/v0.2/install.md new file mode 100644 index 00000000..45408d25 --- /dev/null +++ b/product/en/docs-ptk/v0.2/install.md @@ -0,0 +1,50 @@ +--- +title: Installation +summary: Installation +author: Yao Qian +date: 2022-05-30 +--- + +## Installation + +PTK is a provisioning toolkit. It does not need to be installed on the same server together with a database instance. It is recommended that a management server is used to install PTK and deploy database instances on other servers. + +### Online Installation + +> **Note**: Command line installation does not support PTK installed on Windows. + +You can run the following command to install PTK on macOS or Linux operating systems. + +```shell +curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh +``` + +After running the command, PTK is automatically installed in the `$HOME/.ptk` directory where cache files, data files, cluster configuration files, and backup files are stored. Additionally, the `$HOME/.ptk/bin` directory will be automatically updated to the environment variable of the corresponding Shell profile file. After login, you can run the ptk-related commands. + +### Offline Installation + +If the server where PTK is to be installed cannot be connected to the external network or you need to install PTK on Windows, you can manually install PTK. + +Perform the following operations to install PTK manually: + +**Step 1** Download the installation package corresponding to your server. The following lists installation packages of the latest versions corresponding to different system architectures. + +- MacOS ARM64: [ptk_darwin_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_darwin_arm64.tar.gz) +- MacOS X86: [ptk_darwin_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_darwin_x86_64.tar.gz) +- Linux ARM64: [ptk_linux_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_linux_arm64.tar.gz) +- Linux X86: [ptk_linux_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_linux_x86_64.tar.gz) +- Windows X86: [ptk_windows_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_windows_x86_64.tar.gz) + +**Step 2** Copy the installation package to the target server on the intranet. + +**Step 3** Decompress the package to obtain a binary file named `ptk` (executable file of PTK) and move the file to a directory (`$HOME/.ptk/bin/` is recommended and it needs to be manually created) as you need. Update the directory to the PTK PATH environment variable. + +### PTK Upgrade + +For offline installation, download the latest installation package to cover the binary file on the server to upgrade PTK. + +For online installation, run the following command to upgrade PTK. + +```shell +ptk self upgrade +``` \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/overview.md b/product/en/docs-ptk/v0.2/overview.md new file mode 100644 index 00000000..5f36bacb --- /dev/null +++ b/product/en/docs-ptk/v0.2/overview.md @@ -0,0 +1,49 @@ +--- +title: PTK Overview +summary: PTK Overview +author: Yao Qian +date: 2022-05-30 +--- + +## PTK Overview + +PTK (Provisioning Toolkit) is an installation and operation and maintenance tool for MogDB. It aims at quick installation of MogDB. + +If you need to run MogDB or its related components, only one command needs to be run. + +## Application Scenarios + +- Developers need to quickly enable multiple local MogDB processes. +- Users need to install MogDB quickly using PTK. +- Daily operation and maintenance by DBAs +- A third-party operation and maintenance platform needs to be integrated. + +## Operating Systems Supported by PTK for Installing MogDB + +You can run `ptk candidate os` to check the latest OSs supported. + +| OS | CPU | +| ----------- | -------------- | +| CentOS 7 |x86_64| +| CentOS 8 |x86_64| +| CentOS 8 |arm64| +| EulerOS 2 |arm64| +| EulerOS 2 |x86_64| +| Kylin V10 |arm64| +| Kylin V10 |x86_64| +| NeoKylin V7 |x86_64| +| Oracle Linux Server 7 |x86_64| +| Oracle Linux Server 8 |x86_64| +| openEuler 20 |arm64| +| openEuler 20 |x86_64| +| openEuler 22 |arm64| +| openEuler 22 |x86_64| +| RedHat 7 |x86_64| +| Rocky Linux 7 |x86_64| +| Rocky Linux 8 |x86_64| +| SLES 12 |arm64| +| Ubuntu 18 |x86_64| +| UOS 20 | arm64| +| UOS 20 |x86_64| + +*For other OSs, the adaptation tests are in progress.* \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/quick-start.md b/product/en/docs-ptk/v0.2/quick-start.md new file mode 100644 index 00000000..abae9343 --- /dev/null +++ b/product/en/docs-ptk/v0.2/quick-start.md @@ -0,0 +1,127 @@ +--- +title: Quick Start +summary: Quick Start +author: Yao Qian +date: 2022-06-02 +--- + +## Quick Start + +This document introduces how to quickly install MogDB using PTK. + +> **Note**: PTK can run on multiple operating systems, such as Linux, macOS, and Windows. MogDB can be run on only Linux operating systems, and therefore make sure that a server on which MogDB is installed must run on a Linux operating system. For details about Linux OS types and versions, see [Operating Systems Supported by PTK for Installing MogDB](./overview.md#Operating Systems Supported by PTK for Installing MogDB)。 + +### 1. Downloading and Installing PTK + +run the following command to install PTK: + +```shell +curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh +``` + +Information similar to the following is displayed (the information varies depending on the type of Shell for running PTK) + +``` +info: downloading ptk package +Detected shell: bash +Shell profile: /root/.bashrc +ptk has been added to PATH in /root/.bashrc +open a new terminal or source /root/.bashrc to active it +Installed path: /root/.ptk/bin/ptk +``` + +Run the source command or open a terminal to make PTK environment variables take effect. + +For example, use bash as an example: + +```shell +source $HOME/.bashrc +``` + +### 2. Installing MogDB Using PTK + +#### 2.1 Prepare a configuration file + +PTK installation requires a **config.yaml** configuration file provided by users. + +```yaml +# config.yaml +global: + cluster_name: mogdb1 + user: omm + group: omm + base_dir: /opt/mogdb +db_servers: + - host: 127.0.0.1 + db_port: 26000 +``` + +If default settings are used in the configuration file, PTK will perform the following operations: + +* MogDB is installed on the local server. +* The operating system user for running the database is omm, the user group name is omm, and the user does not have a default password. +* The database is installed in the **/opt/mogdb** directory where four directories **app**, **data**, **log**, and **tool** will be created for storing database software, data files, database logs, and database-related tools. +* The listening port of the database is 26000. + +If MogDB needs to be installed on other servers or primary/standby MogDB is to be installed, [more configuration information](./config.md) needs to be added to **config.yaml**. For details, see [Usage](./usage.md). + +Configuration example for one primary node and one standby node + +```yaml +# config.yaml +global: + cluster_name: mogdb_cluster1 + user: omm + group: omm + base_dir: /opt/mogdb +db_servers: + - host: 192.168.0.1 + db_port: 26000 + role: primary + ssh_option: + port: 22 + user: root + password: [Enter the SSH login password] + - host: 192.168.0.2 + db_port: 26000 + role: standby + ssh_option: + port: 22 + user: root + password: [Enter the SSH login password] +``` + +#### 2.2 Perform System Check on the Local Server + +```shell +ptk checkos -f config.yaml +``` + +Make sure the check result includes `OK` or `Warning`. If `Abnormal` occurs, the users needs to modify system parameters based on logs. + +#### 2.3 Install MogDB + +```shell +ptk install -f config.yaml +``` + +The MogDB of the latest version will be installed by default. You can check the version from the download page of the official website. During the installation, you will be prompted to enter the initial password of the database user, and make sure that you take a note of the password. After automatic installation of MogDB using PTK, the database instance will be started. + +PTK supports customization of the installation package and manual downloading of the installation package. For example, run the following command to install MogDB using the installation package in the current directory: + +```shell +ptk install -f config.yaml --pkg ./MogDB-3.0.0-openEuler-arm64.tar.gz +``` + +After successful installation, you can check the instance information by running the `ptk ls`command. + +### 3. Accessing MogDB + +```bash +su - omm +gsql -d postgres -p 26000 +``` + +## Related Page + +The above example provides the simplest configuration file, thereby facilitating quick experience of MogDB. For more configuration information, see [Configuration File](./config.md). \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/release.md b/product/en/docs-ptk/v0.2/release.md new file mode 100644 index 00000000..78cfcb4d --- /dev/null +++ b/product/en/docs-ptk/v0.2/release.md @@ -0,0 +1,57 @@ +--- +title: Release Note +summary: Release Note +author: Yao Qian +date: 2022-06-01 +--- + +## PTK of the Latest Versions + +- MacOS ARM64: [ptk_darwin_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_darwin_arm64.tar.gz) +- MacOS X86: [ptk_darwin_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_darwin_x86_64.tar.gz) +- Linux ARM64: [ptk_linux_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_linux_arm64.tar.gz) +- Linux X86: [ptk_linux_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_linux_x86_64.tar.gz) +- Windows X86: [ptk_windows_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/latest/ptk_windows_x86_64.tar.gz) + +## Release Note + +### v0.2.3 (2022.7.4) + +#### Change Log + +- Fix the issue that the status of the three-node cluster is incorrectly displayed. +- Support Oracle Linux, Rocky Linux, and Neokylin +- Add the cluster name, user, and port fields in the installation result table. + +#### Download Address + +- [ptk_0.2.3_linux_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.3/ptk_0.2.3_linux_x86_64.tar.gz) +- [ptk_0.2.3_linux_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.3/ptk_0.2.3_linux_arm64.tar.gz) +- [ptk_0.2.3_darwin_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.3/ptk_0.2.3_darwin_x86_64.tar.gz) +- [ptk_0.2.3_darwin_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.3/ptk_0.2.3_darwin_arm64.tar.gz) +- [ptk_0.2.3_windows_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.3/ptk_0.2.3_windows_x86_64.tar.gz) + +### v0.2.0 (2022.6.30) + +#### Change Log + +- Support installation of MogDB 3.0.0. +- Support installation of CM components +- Optimize the system check logic. +- Forcibly encrypt the password field in the configuration file. + +#### Download Address + +- [ptk_0.2.0_linux_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.0/ptk_0.2.0_linux_x86_64.tar.gz) +- [ptk_0.2.0_linux_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.0/ptk_0.2.0_linux_arm64.tar.gz) +- [ptk_0.2.0_darwin_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.0/ptk_0.2.0_darwin_x86_64.tar.gz) +- [ptk_0.2.0_darwin_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.0/ptk_0.2.0_darwin_arm64.tar.gz) +- [ptk_0.2.0_windows_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.2.0/ptk_0.2.0_windows_x86_64.tar.gz) + +### v0.1.0 (2022.6.1) + +- [ptk_0.1.0_linux_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.1.0/ptk_0.1.0_linux_x86_64.tar.gz) +- [ptk_0.1.0_linux_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.1.0/ptk_0.1.0_linux_arm64.tar.gz) +- [ptk_0.1.0_darwin_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.1.0/ptk_0.1.0_darwin_x86_64.tar.gz) +- [ptk_0.1.0_darwin_arm64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.1.0/ptk_0.1.0_darwin_arm64.tar.gz) +- [ptk_0.1.0_windows_x86_64.tar.gz](https://cdn-mogdb.enmotech.com/ptk/v0.1.0/ptk_0.1.0_windows_x86_64.tar.gz) diff --git a/product/en/docs-ptk/v0.2/usage.md b/product/en/docs-ptk/v0.2/usage.md new file mode 100644 index 00000000..fc39e85c --- /dev/null +++ b/product/en/docs-ptk/v0.2/usage.md @@ -0,0 +1,256 @@ +--- +title: Usage Guide +summary: Use Guide +author: Yao Qian +date: 2022-05-30 +--- + +> Note: +> To operate with PTK as the non-root user, make sure that the user has the sudo permission. You can add the following content to the /etc/sudoers file (replace USERNAME as required): +> `[USERNAME] ALL=(ALL) NOPASSWD:ALL` + +## Viewing Help Information + +After PTK is successfully installed, you can run `ptk -h` to view the help information. For details about command parameters, see [PTK Command Reference](command.md). + +## Viewing Version + +You can run `ptk -v` to view PTK version. + +```shell +$ ptk -v +PTK Version: v0.1.0 +Go Version: go1.17.1 +Build Date: 2022-05-27T09:32:14Z +Git Hash: 6aba9ea +``` + +The output includes the PTK version, Golang version in compilation, build time, and git hash value. + +## Creating a Topology Configuration File + +Before installing the database, PTK can be used to create a configuration file for defining the expected database cluster topology. + +To install a single-instance database, run the following command to generate a configuration file. + +```shell +ptk template -l > config.yaml +``` + +To install a multi-instance cluster, run the following command to generate a configuration file. + +```shell +ptk template > config.yaml +``` + +After PTK is run, a `config.yaml` file is generated in the current folder. You need to replace the value of the HOST field with the actual IP address. If there is the password field, you need to run [ptk encrypt](commands/ptk-encrypt.md) to encrypt the password and then add the ciphertext to the configuration file. + +If you are not sure about the meaning of each field, run the following command to create a configuration file. PTK supports configuration file creation in an interactive way. + +```shell +ptk template create +``` + +## System Check + +Before installing the database, you need to check the system parameters and software dependencies of the server where the database is to be installed to ensure smooth installation. + +You can run `checkos` to perform system check. During the check, PTK checks the following modules. + +| No. | Category | Check Item | Description | +| -------- | ------------ | ----------------------------- | -------------------- | +| A1 | System version | Check_OS_Version | Checks the system version. | +| A2 | Kernel version | Check_Kernel_Version | Checks the kernel version. | +| A3 | Character set | Check_Unicode | Check the character set. | +| A4 | Time zone | Check_TimeZone | Checks the time zone. | +| A5 | Swap memory | Check_Swap_Memory_Configure | Checks the swap memory configuration. | +| A6 | sysctl parameter | Check_SysCtl_Parameter | Checks the sysctl parameter. | +| A7 | File system | Check_FileSystem_Configure | Checks the file system configuration. | +| A8 | Disk | Check_Disk_Configure | Checks the disk configuration. | +| A9 | Preread block | Check_BlockDev_Configure | Checks the block configuration. | +| | | Check_Logical_Block | Checks the logic block. | +| A10 | IO scheduling | Check_IO_Request | Checks the IO request parameters. | +| | | Check_Asynchronous_IO_Request | Checks the asynchronous IO request parameters. | +| | | Check_IO_Configure | Checks the IO configuration. | +| A11 | Network | Check_Network_Configure | Checks the network configuration. | +| A12 | Clock consistency | Check_Time_Consistency | Checks the clock consistency. | +| A13 | Firewall | Check_Firewall_Service | Checks the firewall configuration. | +| A14 | Transparent huge page | Check_THP_Service | Checks the transparent huge page configuration. | +| A15 | Dependencies | Check_Dependent_Package | Checks the database system installation dependencies. | +| A16 | CPU command set | Check_CPU_Instruction_Set | Checks the CPU command set. | + +To perform system check using PTK, you need to specify the cluster configuration file using`-f` and content to be checked using `-i`. If the content to be checked is unknown, all check items listed in the above table will be checked by default. + +To check individual check items, specify the check items by separating their item numbers with commas. + +Example: + +```shell +ptk checkos -i A1,A2,A3 # To check multiple check items, enter the item number in the -i A1,A2,A3 format. +ptk checkos -i A # Check all check items. +ptk checkos -i A --detail # Display details. +``` + +The PTK check result includes four levels. + +- **OK**: The check result reaches expectations and meets the installation requirement. +- **Warning**: The check result does not reach expectations but meets the installation requirement. +- **Abnormal**: The check result does not meet the installation requirement. The installation may fail. The exception needs to be handled manually based on the suggested script by PTK. +- **ExecuteError**: PTK failed to execute commands during system check. The reason may be that some tools are not installed in the environment or there is an internal bug. This error needs to be handled based on the actual prompt information. + +Before installing the database, make sure that the check result of all check items is `OK` or `Warning`. If the check result displays `Abnormal`, an error may occur during installation and installation exits. + +## Database Cluster Installation + +After a configuration file is created and the system check is successful, you can start to install a database. + +You can run the following command to install a database. + +```shell +$ ptk install -f config.yaml -y +``` + +`-f` specifies the configuration file path. `-y` specifies that yes is replied automatically for all interactive questions. (Note: If the initial password is not configured in the configuration file, `-y` cannot skip the password setting process.) + +MogDB of the version corresponding to PTK release will be installed by default. You can run `ptk install -h` to query the default value of `--db-version`. + +PTK also supports installation of a database of a different version or a database compiled by yourself. + +Parameter `--db-version` allows you to install MogDB of a specified version. For example, run `ptk install -f config.yaml --db-version 2.0.1 -y` to install MogDB 2.0.1. For details about the supported MogDB versions, see [MogDB Download](https://www.mogdb.io/downloads/mogdb/). + +To install a database using an installation package compiled by yourself or an openGauss package from the openGauss community, use parameter `-p|--pkg` to specify the local path for storing the installation package or network address. PTK distributes the installation package from the server where it is located to other servers. + +More options are as follows: + +- `-e|--env` : adds environment variables to the database system user environment after database installation. +- `--launch-db-timeout`: specifies the database start timeout duration. The default value is 5 minutes. +- `--pre-run`: adds a shell script path and executes the specified script on all servers in a cluster before cluster installation. +- `--post-run`: adds a shell script path and executes the specified script on all servers in a cluster after cluster installation. +- `--skip-check-os`: skips the system check. +- `--skip-check-distro`: skips system release check. +- `--skip-create-user`: PTK automatically creates a user by default. This option skips user creation. When this option is specified, make sure that a user must exist in the server. +- `--skip-launch-db`: does not start database after installation. +- `--skip-rollback`: PTK rolls back all operations to clear environment by default once an error occurs. This option does not allow rollback operations. +- `--install-cm`: installs the CM component during database installation (applied to MogDB 3.0.0 or later or scenarios where at least three instances are installed in a cluster). +- `--no-cache`: does not use an +- installation package in the local cache and downloads the installation package from the specified network. + +## Database Cluster Uninstallation + +> Note: Once a database is uninstalled, it cannot be recovered. Please execute operation without caution. +> + +You can run `ptk uninstall (-f CONFIG.YAML|--name CLUSTER_NAME)` to uninstall a database cluster on the server accommodating PTK. + +You can specify a database cluster to be uninstalled by config.yaml or the cluster name. The prerequisite of specifying a database cluster by the cluster name is that you can find the cluster by running `ptk ls`. + +Before uninstallation, PTK questions you in an interactive way to confirm the topology information of the cluster to be deleted, whether to delete the system user, and whether to delete the database data. Please confirm your answer to each question to avoid data loss due to incorrect operations. + +Before uninstallation, if you confirm deletion of the data directory, PTK will delete only the data directory and will not delete its parent directory. You need to manually delete the parent directory. + +## Database Cluster Management + +### Viewing the Cluster List + +After the database clusters is installed, you can run `ptk ls` to query the list of clusters installed by the current user (Because PTK metadata is stored in the `$HOME/.ptk` directory, you can query the list of the clusters installed under the current user). + +```shell +$ ptk ls + cluster_name | instances | user | data_dir +----------------+--------------------+--------+------------------- + single | 172.16.0.183:21000 | single | /opt/mogdb_single/data + cluster | 172.16.0.114:23000 | cluster| /opt/mogdb_cluster/data + | 172.16.0.190:23000 | | +``` + +You can find the cluster name, the instance list, the system user, and the data directory of the instances from the output table. + +After the database cluster is installed, PTK can use `-f` to specify the configuration file or `--name` to specify the cluster name to uninstall or manage the cluster. + +### Starting/Stopping/Restarting a Cluster + +PTK supports starting and stopping of the whole cluster and also single instance in the cluster. + +To start or stop a cluster, you need to specify the cluster name or configuration file. To manage a cluster by the cluster name, the prerequisite is that the cluster must be installed using PTK and you can find the cluster by running `ptk ls`. + +### Viewing the Cluster Status + +To check whether the database cluster status is normal, run the `status` subcommand. The following shows an example. + +```shell +$ ptk cluster status --name CLUSTER_NAME + +[ Cluster State ] + +database_version : MogDB-3.0.0 +cluster_name : test +cluster_state : Normal +current_az : AZ_ALL + +[ Datanode State ] + + id | ip | port | user | instance | db_role | state +-------+--------------+-------+-------+----------+---------+--------- + 6001 | 172.16.0.100 | 26000 | omm | dn_6001 | primary | Normal + 6002 | 172.16.0.101 | 26000 | omm | dn_6002 | standby | Normal + 6003 | 172.16.0.102 | 26000 | omm | dn_6003 | standby | Normal +``` + +To check details about primary/standby replication status, add the `--detail` parameter to the command. + +## Database Installation Example + +> **CLUSTER_NAME** in the following example needs to be replaced with the actual cluster name. + +### Creating a Configuration File + +```shell +ptk template create -o config.yaml +``` + +### Checking a Server + +```shell +ptk checkos -f config.yaml -i A +``` + +### Installing a Cluster + +```shell +ptk install -f config.yaml +``` + +### Querying the Cluster Status + +```shell +ptk cluster status --name CLUSTER_NAME + +# View cluster details. +ptk cluster status --name CLUSTER_NAME --detail +``` + +### Starting or Stopping a Cluster + +```shell +# stop +ptk cluster stop --name CLUSTER_NAME + +# stop a node +ptk cluster stop --name CLUSTER_NAME -H HOST_IP +# stop a node with mode(f:fast, i:immediate) +ptk cluster stop --name CLUSTER_NAME -H HOST_IP --mode f + +# start +ptk cluster start --name CLUSTER_NAME + +# start a node +ptk cluster start --name CLUSTER_NAME -H HOST_IP +# start a node with security-mode +ptk cluster start --name CLUSTER_NAME -H HOST_IP --security-mode on +``` + +### Uninstalling a Cluster + +```shell +ptk uninstall --name CLUSTER_NAME +``` \ No newline at end of file diff --git a/product/zh/docs-mogdb/v3.0/installation-guide/ptk-based-installation.md b/product/zh/docs-mogdb/v3.0/installation-guide/ptk-based-installation.md index d30766dd..47097167 100644 --- a/product/zh/docs-mogdb/v3.0/installation-guide/ptk-based-installation.md +++ b/product/zh/docs-mogdb/v3.0/installation-guide/ptk-based-installation.md @@ -132,7 +132,7 @@ ptk install -f config.yaml --pkg ./MogDB-3.0.0-openEuler-arm64.tar.gz [root@hostname]# ptk ls cluster_name | instances | user | data_dir | db_version ---------------+--------------------+------+-----------------+-------------- - mogdb1 | 172.16.0.127:27000 | omm | /opt/mogdb/data | MogDB-3.0.0 + mogdb1 | 172.16.0.127:26000 | omm | /opt/mogdb/data | MogDB-3.0.0 ``` ### 访问数据库 @@ -172,7 +172,7 @@ global: tmp_dir: /opt/mogdb/tmp db_servers: - host: 172.16.0.127 - db_port: 27000 + db_port: 26000 role: primary az_name: AZ1 az_priority: 1 diff --git a/product/zh/docs-mogdb/v3.0/quick-start/installation-on-a-single-node.md b/product/zh/docs-mogdb/v3.0/quick-start/installation-on-a-single-node.md index d95d5b37..7ad3b13e 100644 --- a/product/zh/docs-mogdb/v3.0/quick-start/installation-on-a-single-node.md +++ b/product/zh/docs-mogdb/v3.0/quick-start/installation-on-a-single-node.md @@ -127,7 +127,7 @@ ptk install -f config.yaml --pkg ./MogDB-3.0.0-openEuler-arm64.tar.gz [root@hostname]# ptk ls cluster_name | instances | user | data_dir | db_version ---------------+--------------------+------+-----------------+-------------- - mogdb1 | 172.16.0.127:27000 | omm | /opt/mogdb/data | MogDB-3.0.0 + mogdb1 | 172.16.0.127:26000 | omm | /opt/mogdb/data | MogDB-3.0.0 ``` ### 访问数据库 @@ -167,7 +167,7 @@ global: tmp_dir: /opt/mogdb/tmp db_servers: - host: 172.16.0.127 - db_port: 27000 + db_port: 26000 role: primary az_name: AZ1 az_priority: 1 -- Gitee From bed4c56056963027e7f228a60293e04328e35b86 Mon Sep 17 00:00:00 2001 From: zcp100_zcp100 Date: Fri, 15 Jul 2022 11:48:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?update(mogdb):=E5=B0=91=E9=87=8F=E7=A9=BA?= =?UTF-8?q?=E8=A1=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product/en/docs-ptk/v0.2/commands/ptk-self.md | 3 +-- product/en/docs-ptk/v0.2/commands/ptk-template.md | 3 +-- product/en/docs-ptk/v0.2/config.md | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/product/en/docs-ptk/v0.2/commands/ptk-self.md b/product/en/docs-ptk/v0.2/commands/ptk-self.md index e6266e31..ce38ec66 100644 --- a/product/en/docs-ptk/v0.2/commands/ptk-self.md +++ b/product/en/docs-ptk/v0.2/commands/ptk-self.md @@ -25,5 +25,4 @@ ptk self [command] ## Subcommand -[ptk self upgrade](ptk-self-upgrade.md): PTK upgrade - +[ptk self upgrade](ptk-self-upgrade.md): PTK upgrade \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/commands/ptk-template.md b/product/en/docs-ptk/v0.2/commands/ptk-template.md index 0e2b0dfd..9495789a 100644 --- a/product/en/docs-ptk/v0.2/commands/ptk-template.md +++ b/product/en/docs-ptk/v0.2/commands/ptk-template.md @@ -67,5 +67,4 @@ Outputs original content and ciphertext in the key-value format. If multiple pas ## Subcommand -- [ptk template create][ptk-template-create.md] - +- [ptk template create][ptk-template-create.md] \ No newline at end of file diff --git a/product/en/docs-ptk/v0.2/config.md b/product/en/docs-ptk/v0.2/config.md index 3b9b2029..98297949 100644 --- a/product/en/docs-ptk/v0.2/config.md +++ b/product/en/docs-ptk/v0.2/config.md @@ -27,8 +27,6 @@ ptk template > config.yaml When you do not create the configuration file in an interactive way, you are advised to encrypt the system user password, database password, SSH password, or key password by running the PTK encryption command before writing the password into the configuration file. - - ```shell ptk encrypt PASSWORD ``` @@ -665,8 +663,6 @@ key_file: ~/.ssh/id_rsa **Description**: IP address of the target server to be connected
This field is mandatory when the host works as a jump server.
When the server has the database installed, this field can be left blank. The IP address of db_server will be used.
This field is left blank by default. - - **Added in**: v0.1 ### port -- Gitee