From 662ae51191464a90fdb1901780f4c85f633d0308 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Mon, 4 Dec 2023 16:10:01 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix(mogdb):=E5=AD=90=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2sql=E8=AF=AD=E6=B3=95=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql-reference/sub-query.md | 360 +++++++++--------- .../sql-reference/sub-query.md | 8 +- .../sql-reference/sub-query.md | 12 +- .../sql-reference/sub-query.md | 12 +- 4 files changed, 196 insertions(+), 196 deletions(-) diff --git a/product/en/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md b/product/en/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md index 07ebab7c..88fc22cc 100644 --- a/product/en/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md +++ b/product/en/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md @@ -1,181 +1,181 @@ ---- -title: Subqueries -summary: Subqueries -author: zhang cuiping -date: 2023-04-07 ---- - -# Subqueries - -A subquery, also called an internal query, is a nested query. The subquery embeds a query statement in the **WHERE** clause of a database query and it is equivalent to a temporary table. The query result of a SELECT statement can be used as the input value of another statement. - -A subquery can be used with the SELECT, INSERT, UPDATE, and DELETE statements. - -The subquery must comply with the following rules: - -- The subquery must be enclosed in parentheses. -- The subquery can have only one column in the **SELECT** clause, unless there are multiple columns in the main query to compare with the columns selected by the subquery. -- **ORDER BY** cannot be used in the subquery, although it can be used in the main query. **GROUP BY** can be used in the subquery with the same function as **ORDER BY**. -- The subquery returns more than one row. It can be used only with multi-value operators, such as IN. -- The BETWEEN operator cannot be used with the subquery, but it can be used inside the subquery. - -## Subquery in the SELECT Statement - -The SELECT statement queries the data returned by the subquery. The basic syntax is as follows: - -```css -SELECT column_name [, column_name ] -FROM table1 [, table2 ] -WHERE column_name OPERATOR - (SELECT column_name [, column_name ] - FROM table1 [, table2 ] - [WHERE]); -``` - -Example: - -Create the **customer** table. The data is as follows: - -```sql -MogDB=# SELECT * FROM customer_t1; - c_customer_sk | c_customer_id | c_first_name | c_last_name | amount ----------------+---------------+--------------+-------------+-------- - 3869 | hello | Grace | | 1000 - 3869 | | Grace | | - 3869 | hello | | | - 6985 | maps | Joes | | 2200 - 9976 | world | James | | 5000 - 4421 | Admin | Local | | 3000 -(6 rows) -``` - -Run the following statement to use a subquery in the SELECT statement: - -```sql -MogDB=# SELECT * FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_t1 WHERE amount > 2500) ; - c_customer_sk | c_customer_id | c_first_name | c_last_name | amount ----------------+---------------+--------------+-------------+-------- - 9976 | world | James | | 5000 - 4421 | Admin | Local | | 3000 -(2 rows) -``` - -## Subquery in the INSERT Statement - -Subqueries can also be used with the INSERT statement. The INSERT statement inserts the data returned by the subquery into another table. The basic syntax is as follows: - -```css -INSERT INTO table_name [ (column1 [, column2 ]) ] -SELECT [ *|column1 [, column2 ] ] -FROM table1 [, table2 ] -[ WHERE VALUE OPERATOR ] -``` - -Example: - -Create the **customer_bak** table whose structure is the same as that of the **customer_t1** table. - -```sql -MogDB=# CREATE TABLE customer_bak -( - c_customer_sk integer, - c_customer_id char(5), - c_first_name char(6), - c_last_name char(8), - Amount integer -); -CREATE TABLE -``` - -Insert data in the **customer_t1** table into the **customer_bak** table. - -```sql -MogDB=# INSERT INTO customer_bak SELECT * FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_t1) ; -INSERT 0 6 -``` - -After the data is inserted, data in the **customer_bak** table is as follows: - -```sql -MogDB=# SELECT * FROM customer_bak; - c_customer_sk | c_customer_id | c_first_name | c_last_name | amount ----------------+---------------+--------------+-------------+-------- - 3869 | hello | Grace | | 1000 - 3869 | | Grace | | - 3869 | hello | | | - 6985 | maps | Joes | | 2200 - 9976 | world | James | | 5000 - 4421 | Admin | Local | | 3000 -(6 rows) -``` - -## Subquery in the UPDATE Statement - -When a subquery is run by executing the UPDATE statement, multiple columns in the table are updated. The basic syntax is as follows: - -```sql -UPDATE table -SET column_name = new_value -[ WHERE OPERATOR [ VALUE ] - (SELECT COLUMN_NAME - FROM TABLE_NAME - [ WHERE ]) -``` - -Example: - -Change the value of **amount** of all customers whose **c_customer_sk** is set to a value greater than **4000** in the **customer_t1** table to 0.50 times of the original value. - -```sql -MogDB=# UPDATE customer_t1 SET amount = amount * 0.50 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_bak WHERE c_customer_sk > 5000 ); -UPDATE 2 -``` - -The update operation affects two rows. After the update, the data in the **customer_t1** table is as follows: - -```sql -MogDB=# SELECT * FROM customer_t1; - c_customer_sk | c_customer_id | c_first_name | c_last_name | amount ----------------+---------------+--------------+-------------+-------- - 3869 | hello | Grace | | 1000 - 3869 | | Grace | | - 3869 | hello | | | - 4421 | Admin | Local | | 3000 - 6985 | maps | Joes | | 1100 - 9976 | world | James | | 2500 -(6 rows) -``` - -## Subquery in the DELETE Statement - -The basic syntax is as follows: - -```sql -DELETE FROM TABLE_NAME -[ WHERE OPERATOR [ VALUE ] - (SELECT COLUMN_NAME - FROM TABLE_NAME - [ WHERE ]) -``` - -Example: - -Delete all customers whose **c_customer_sk** is set to a value greater than **4000** from the **customer_t1** table. - -```sql -MogDB=# DELETE FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_bak WHERE c_customer_sk > 5000 ); -DELETE 2 -``` - -The deletion operation affects two rows. After deletion, the data in the **customer_t1** table is as follows: - -```sql -MogDB=# SELECT * FROM customer_t1; - c_customer_sk | c_customer_id | c_first_name | c_last_name | amount ----------------+---------------+--------------+-------------+-------- - 3869 | hello | Grace | | 1000 - 3869 | | Grace | | - 3869 | hello | | | - 4421 | Admin | Local | | 3000 -(4 rows) +--- +title: Subqueries +summary: Subqueries +author: zhang cuiping +date: 2023-04-07 +--- + +# Subqueries + +A subquery, also called an internal query, is a nested query. The subquery embeds a query statement in the **WHERE** clause of a database query and it is equivalent to a temporary table. The query result of a SELECT statement can be used as the input value of another statement. + +A subquery can be used with the SELECT, INSERT, UPDATE, and DELETE statements. + +The subquery must comply with the following rules: + +- The subquery must be enclosed in parentheses. +- The subquery can have only one column in the **SELECT** clause, unless there are multiple columns in the main query to compare with the columns selected by the subquery. +- **ORDER BY** cannot be used in the subquery, although it can be used in the main query. **GROUP BY** can be used in the subquery with the same function as **ORDER BY**. +- The subquery returns more than one row. It can be used only with multi-value operators, such as IN. +- The BETWEEN operator cannot be used with the subquery, but it can be used inside the subquery. + +## Subquery in the SELECT Statement + +The SELECT statement queries the data returned by the subquery. The basic syntax is as follows: + +```sql +SELECT column_name [, column_name ] +FROM table1 [, table2 ] +WHERE column_name OPERATOR + (SELECT column_name [, column_name ] + FROM table1 [, table2 ] + [WHERE]); +``` + +Example: + +Create the **customer** table. The data is as follows: + +```sql +MogDB=# SELECT * FROM customer_t1; + c_customer_sk | c_customer_id | c_first_name | c_last_name | amount +---------------+---------------+--------------+-------------+-------- + 3869 | hello | Grace | | 1000 + 3869 | | Grace | | + 3869 | hello | | | + 6985 | maps | Joes | | 2200 + 9976 | world | James | | 5000 + 4421 | Admin | Local | | 3000 +(6 rows) +``` + +Run the following statement to use a subquery in the SELECT statement: + +```sql +MogDB=# SELECT * FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_t1 WHERE amount > 2500) ; + c_customer_sk | c_customer_id | c_first_name | c_last_name | amount +---------------+---------------+--------------+-------------+-------- + 9976 | world | James | | 5000 + 4421 | Admin | Local | | 3000 +(2 rows) +``` + +## Subquery in the INSERT Statement + +Subqueries can also be used with the INSERT statement. The INSERT statement inserts the data returned by the subquery into another table. The basic syntax is as follows: + +```sql +INSERT INTO table_name [ (column1 [, column2 ]) ] +SELECT [ *|column1 [, column2 ] ] +FROM table1 [, table2 ] +[ WHERE VALUE OPERATOR ] +``` + +Example: + +Create the **customer_bak** table whose structure is the same as that of the **customer_t1** table. + +```sql +MogDB=# CREATE TABLE customer_bak +( + c_customer_sk integer, + c_customer_id char(5), + c_first_name char(6), + c_last_name char(8), + Amount integer +); +CREATE TABLE +``` + +Insert data in the **customer_t1** table into the **customer_bak** table. + +```sql +MogDB=# INSERT INTO customer_bak SELECT * FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_t1) ; +INSERT 0 6 +``` + +After the data is inserted, data in the **customer_bak** table is as follows: + +```sql +MogDB=# SELECT * FROM customer_bak; + c_customer_sk | c_customer_id | c_first_name | c_last_name | amount +---------------+---------------+--------------+-------------+-------- + 3869 | hello | Grace | | 1000 + 3869 | | Grace | | + 3869 | hello | | | + 6985 | maps | Joes | | 2200 + 9976 | world | James | | 5000 + 4421 | Admin | Local | | 3000 +(6 rows) +``` + +## Subquery in the UPDATE Statement + +When a subquery is run by executing the UPDATE statement, multiple columns in the table are updated. The basic syntax is as follows: + +```sql +UPDATE table +SET column_name = new_value + WHERE OPERATOR [ VALUE ] + (SELECT COLUMN_NAME + FROM TABLE_NAME + [ WHERE ]) +``` + +Example: + +Change the value of **amount** of all customers whose **c_customer_sk** is set to a value greater than **4000** in the **customer_t1** table to 0.50 times of the original value. + +```sql +MogDB=# UPDATE customer_t1 SET amount = amount * 0.50 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_bak WHERE c_customer_sk > 5000 ); +UPDATE 2 +``` + +The update operation affects two rows. After the update, the data in the **customer_t1** table is as follows: + +```sql +MogDB=# SELECT * FROM customer_t1; + c_customer_sk | c_customer_id | c_first_name | c_last_name | amount +---------------+---------------+--------------+-------------+-------- + 3869 | hello | Grace | | 1000 + 3869 | | Grace | | + 3869 | hello | | | + 4421 | Admin | Local | | 3000 + 6985 | maps | Joes | | 1100 + 9976 | world | James | | 2500 +(6 rows) +``` + +## Subquery in the DELETE Statement + +The basic syntax is as follows: + +```sql +DELETE FROM TABLE_NAME + WHERE OPERATOR [ VALUE ] + (SELECT COLUMN_NAME + FROM TABLE_NAME + [ WHERE ]) +``` + +Example: + +Delete all customers whose **c_customer_sk** is set to a value greater than **4000** from the **customer_t1** table. + +```sql +MogDB=# DELETE FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk FROM customer_bak WHERE c_customer_sk > 5000 ); +DELETE 2 +``` + +The deletion operation affects two rows. After deletion, the data in the **customer_t1** table is as follows: + +```sql +MogDB=# SELECT * FROM customer_t1; + c_customer_sk | c_customer_id | c_first_name | c_last_name | amount +---------------+---------------+--------------+-------------+-------- + 3869 | hello | Grace | | 1000 + 3869 | | Grace | | + 3869 | hello | | | + 4421 | Admin | Local | | 3000 +(4 rows) ``` \ No newline at end of file diff --git a/product/en/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md b/product/en/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md index 21550e69..88fc22cc 100644 --- a/product/en/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md +++ b/product/en/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md @@ -23,7 +23,7 @@ The subquery must comply with the following rules: The SELECT statement queries the data returned by the subquery. The basic syntax is as follows: -```css +```sql SELECT column_name [, column_name ] FROM table1 [, table2 ] WHERE column_name OPERATOR @@ -64,7 +64,7 @@ MogDB=# SELECT * FROM customer_t1 WHERE c_customer_sk IN (SELECT c_customer_sk F Subqueries can also be used with the INSERT statement. The INSERT statement inserts the data returned by the subquery into another table. The basic syntax is as follows: -```css +```sql INSERT INTO table_name [ (column1 [, column2 ]) ] SELECT [ *|column1 [, column2 ] ] FROM table1 [, table2 ] @@ -116,7 +116,7 @@ When a subquery is run by executing the UPDATE statement, multiple columns in th ```sql UPDATE table SET column_name = new_value -[ WHERE OPERATOR [ VALUE ] + WHERE OPERATOR [ VALUE ] (SELECT COLUMN_NAME FROM TABLE_NAME [ WHERE ]) @@ -152,7 +152,7 @@ The basic syntax is as follows: ```sql DELETE FROM TABLE_NAME -[ WHERE OPERATOR [ VALUE ] + WHERE OPERATOR [ VALUE ] (SELECT COLUMN_NAME FROM TABLE_NAME [ WHERE ]) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md index 1729adb8..63bd1018 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/sub-query.md @@ -23,8 +23,8 @@ date: 2023-04-07 SELECT语句在子查询返回的数据中进行查询。基本语法如下: -``` -hSELECT column_name [, column_name ] +```sql +SELECT column_name [, column_name ] FROM table1 [, table2 ] WHERE column_name OPERATOR (SELECT column_name [, column_name ] @@ -113,10 +113,10 @@ MogDB=# SELECT * FROM customer_bak; 通过UPDATE语句使用子查询时,表中多个列被更新。基本语法如下: -``` +```sql UPDATE table SET column_name = new_value -[ WHERE OPERATOR [ VALUE ] + WHERE OPERATOR [ VALUE ] (SELECT COLUMN_NAME FROM TABLE_NAME [ WHERE ]) @@ -150,9 +150,9 @@ MogDB=# SELECT * FROM customer_t1; 基本语法如下: -``` +```sql DELETE FROM TABLE_NAME -[ WHERE OPERATOR [ VALUE ] + WHERE OPERATOR [ VALUE ] (SELECT COLUMN_NAME FROM TABLE_NAME [ WHERE ]) diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md b/product/zh/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md index 1729adb8..63bd1018 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/sql-reference/sub-query.md @@ -23,8 +23,8 @@ date: 2023-04-07 SELECT语句在子查询返回的数据中进行查询。基本语法如下: -``` -hSELECT column_name [, column_name ] +```sql +SELECT column_name [, column_name ] FROM table1 [, table2 ] WHERE column_name OPERATOR (SELECT column_name [, column_name ] @@ -113,10 +113,10 @@ MogDB=# SELECT * FROM customer_bak; 通过UPDATE语句使用子查询时,表中多个列被更新。基本语法如下: -``` +```sql UPDATE table SET column_name = new_value -[ WHERE OPERATOR [ VALUE ] + WHERE OPERATOR [ VALUE ] (SELECT COLUMN_NAME FROM TABLE_NAME [ WHERE ]) @@ -150,9 +150,9 @@ MogDB=# SELECT * FROM customer_t1; 基本语法如下: -``` +```sql DELETE FROM TABLE_NAME -[ WHERE OPERATOR [ VALUE ] + WHERE OPERATOR [ VALUE ] (SELECT COLUMN_NAME FROM TABLE_NAME [ WHERE ]) -- Gitee From fa176b7b92a85fad029c2348f3041f7a91526638 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Mon, 4 Dec 2023 16:57:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix(mogdb):=E6=9B=BF=E6=8D=A2gaussdb=20kern?= =?UTF-8?q?el=E5=AD=97=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cm-parameters/cm-parameters.md | 24 +++++++++---------- .../cm-parameters/cm-parameters.md | 2 +- .../sql-syntax/ALTER-TABLE-PARTITION.md | 2 +- .../sql-syntax/ALTER-TABLE-SUBPARTITION.md | 2 +- .../sql-syntax/ALTER-TABLE-PARTITION.md | 2 +- .../sql-syntax/ALTER-TABLE-SUBPARTITION.md | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/cm-parameters/cm-parameters.md b/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/cm-parameters/cm-parameters.md index ca3f15d6..8798c6ea 100644 --- a/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/cm-parameters/cm-parameters.md +++ b/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/cm-parameters/cm-parameters.md @@ -1,13 +1,13 @@ ---- -title: CM Parameters -summary: CM Parameters -author: zhang cuiping -date: 2023-04-07 ---- - -# CM Parameters - -Modifying CM parameters affects the running mechanism of GaussDB Kernel. You are advised to ask GaussDB Kernel engineers to do it for you. For details about how to modify the CM parameters, see method 1 in [Table 2 Methods for setting GUC parameters](../../../reference-guide/guc-parameters/appendix.md). - -- **[cm_agent Parameters](cm_agent.md)** +--- +title: CM Parameters +summary: CM Parameters +author: zhang cuiping +date: 2023-04-07 +--- + +# CM Parameters + +Modifying CM parameters affects the running mechanism of MogDB. You are advised to ask MogDB engineers to do it for you. For details about how to modify the CM parameters, see method 1 in [Table 2 Methods for setting GUC parameters](../../../reference-guide/guc-parameters/appendix.md). + +- **[cm_agent Parameters](cm_agent.md)** - **[cm_server Parameters](cm_server.md)** \ No newline at end of file diff --git a/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/cm-parameters/cm-parameters.md b/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/cm-parameters/cm-parameters.md index ee545e2f..8798c6ea 100644 --- a/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/cm-parameters/cm-parameters.md +++ b/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/cm-parameters/cm-parameters.md @@ -7,7 +7,7 @@ date: 2023-04-07 # CM Parameters -Modifying CM parameters affects the running mechanism of GaussDB Kernel. You are advised to ask GaussDB Kernel engineers to do it for you. For details about how to modify the CM parameters, see method 1 in [Table 2 Methods for setting GUC parameters](../../../reference-guide/guc-parameters/appendix.md). +Modifying CM parameters affects the running mechanism of MogDB. You are advised to ask MogDB engineers to do it for you. For details about how to modify the CM parameters, see method 1 in [Table 2 Methods for setting GUC parameters](../../../reference-guide/guc-parameters/appendix.md). - **[cm_agent Parameters](cm_agent.md)** - **[cm_server Parameters](cm_server.md)** \ No newline at end of file diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md index ac6f93d1..02fc12b8 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md @@ -42,7 +42,7 @@ date: 2021-05-17 action [, ... ]; ``` - 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,GaussDB KernelopenGauss总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 + 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,MogDB总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 ```ebnf+diagram action ::= move_clause | diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md index d4eb4a33..9f937d84 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md @@ -39,7 +39,7 @@ date: 2021-11-01 action [, ... ]; ``` - 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,GaussDB KernelopenGauss总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 + 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,MogDB总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 ```ebnf+diagram action::= move_clause | diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md b/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md index ac6f93d1..02fc12b8 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-PARTITION.md @@ -42,7 +42,7 @@ date: 2021-05-17 action [, ... ]; ``` - 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,GaussDB KernelopenGauss总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 + 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,MogDB总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 ```ebnf+diagram action ::= move_clause | diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md b/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md index d4eb4a33..9f937d84 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/sql-syntax/ALTER-TABLE-SUBPARTITION.md @@ -39,7 +39,7 @@ date: 2021-11-01 action [, ... ]; ``` - 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,GaussDB KernelopenGauss总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 + 其中action统指如下分区维护子语法。当存在多个分区维护子句时,保证了分区的连续性,无论这些子句的排序如何,MogDB总会先执行DROP PARTITION再执行ADD PARTITION操作,最后顺序执行其它分区维护操作。 ```ebnf+diagram action::= move_clause | -- Gitee From e4c6f003d85c21a1bd65afabbac31569081a2c98 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Tue, 5 Dec 2023 15:06:07 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix(mogdb):=E4=BF=AE=E6=AD=A3CM=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AEVIP=E9=A1=B5=E9=9D=A2=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E5=B8=B8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manual-configuration-of-vip.md | 10 ++-- .../manual-configuration-of-vip.md | 10 ++-- .../feature-introduction.md | 48 ++++++++--------- .../manual-configuration-of-vip.md | 10 ++-- .../feature-introduction.md | 52 +++++++++---------- .../manual-configuration-of-vip.md | 10 ++-- 6 files changed, 70 insertions(+), 70 deletions(-) diff --git a/product/en/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md b/product/en/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md index 9ca84c20..2826dd3d 100644 --- a/product/en/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md +++ b/product/en/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md @@ -47,11 +47,11 @@ echo "Cluster username ALL=(root) NOPASSWD: COMMAND_FLAG" >> /etc/sudoers Dynamic binding and unbinding of VIP is to operate with a NIC, therefore ifconfig permission is required to allow the cluster user to binding or unbinding an VIP by using sudo ifconfig. This operation may give rise to risks, such as wiretapping, tampering, counterfeiting, and denial of service. Please execute with caution. -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)Warning: -> -> Both of the above commands can only be executed once on each node and cannot be configured twice, or else the `sudo ifconfig` command may report an error. An example of an error is shown below: -> -> ![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) +![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)Warning: + +Both of the above commands can only be executed once on each node and cannot be configured twice, or else the `sudo ifconfig` command may report an error. An example of an error is shown below: + +![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) ### 3. Setting the VIP Resource File diff --git a/product/en/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md b/product/en/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md index 9ca84c20..2826dd3d 100644 --- a/product/en/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md +++ b/product/en/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md @@ -47,11 +47,11 @@ echo "Cluster username ALL=(root) NOPASSWD: COMMAND_FLAG" >> /etc/sudoers Dynamic binding and unbinding of VIP is to operate with a NIC, therefore ifconfig permission is required to allow the cluster user to binding or unbinding an VIP by using sudo ifconfig. This operation may give rise to risks, such as wiretapping, tampering, counterfeiting, and denial of service. Please execute with caution. -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)Warning: -> -> Both of the above commands can only be executed once on each node and cannot be configured twice, or else the `sudo ifconfig` command may report an error. An example of an error is shown below: -> -> ![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) +![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)Warning: + +Both of the above commands can only be executed once on each node and cannot be configured twice, or else the `sudo ifconfig` command may report an error. An example of an error is shown below: + +![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) ### 3. Setting the VIP Resource File diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/feature-introduction.md b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/feature-introduction.md index e834703a..69808dea 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/feature-introduction.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/feature-introduction.md @@ -21,11 +21,11 @@ cm_agent是部署在数据库每个主机上,用来启停和监控各个数据 - 公共选项: - - -V, –version + - -V, --version 打印cm_agent版本信息,然后退出。 - - -?, -h,–help + - -?, -h,--help 显示关于cm_agent命令行参数的帮助信息,然后退出。 @@ -69,11 +69,11 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 - 公共选项: - - -V, –version + - -V, --version 打印cm_server版本信息,然后退出。 - - -?, -h,–help + - -?, -h,--help 显示关于cm_server命令行参数的帮助信息,然后退出。 @@ -126,7 +126,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 1. 资源脚本 主要用于指定资源的启停、状态检查等指令,一个样例如下: - ``` + ```shell #!/bin/bash #set -ex #取消该行注释可帮助调试脚本 #资源名称 @@ -217,9 +217,9 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 以上样例可以作为模板使用,用户主要需要修改的地方包括: 资源名称、资源binPath、用于过滤资源实例的命令关键词、用于保存首次检测到资源僵死时间的文件(可选)、最长僵死时间、记录首次僵死时间的变量名(如果同一节点存在多个不同的自定义资源实例) - 2. 自定义资源配置文件cm_resource.json 该文件位置为cmdir/cm_agent/cm_resource.json,配置该文件后需要重启集群 + 2. 自定义资源配置文件cm_resource.json,该文件位置为cmdir/cm_agent/cm_resource.json,配置该文件后需要重启集群 - ``` + ```json { "resources": [ { @@ -383,7 +383,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 - 手动生成VIP配置文件步骤,在每个节点上都要生成该VIP配置文件,且每个节点要求一致,需要重启集群才能生效(不建议手动操作)。 - ``` + ```shell cm_ctl res --add --res_name="资源名" --res_attr="resources_type=VIP,float_ip=IP1" cm_ctl res --edit --res_name="资源名" --add_inst="node_id=NODE1,res_instance_id=6001" --inst_attr="base_ip=IP2" @@ -428,7 +428,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 - -w 访问来源ip白名单,如果不需要设置白名单则可以不用指定。 启动命令: - ``` + ```shell java -jar cmrestapi-xxx.jar -e envFile [-w appWhiteList] ``` @@ -456,7 +456,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 (1) CMRestAPI默认使用http服务,支持配置访问白名单,可通过启动参数-w配置访问来源ip的白名单文件,白名单文件配置格式为每行一个ip地址; (2) 若要使用https服务,则可以在启动时jar包时指定系统参数server.ssl相关参数来是CMRestAPI启动https服务,或将相关参数写入application.properties文件然后在启动命令中指定配置文件,或配置源码resource目录下的application.properties文件然后自行编译,自定义配置参数示例: - ``` + ```shell -Dserver.port=服务监听端口 -Dserver.ssl.key-store=秘钥文件路径 -Dserver.ssl.key-store-password=秘钥文件密码 -Dserver.ssl.key-store-type=秘钥类型 如: 指定参数方式: @@ -472,7 +472,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 2. 内存相关。 由于本程序使用了springboot框架,默认启动会占用较大内存(约1G左右),若并发量不大不希望该程序占用较大内存,则可以在启动时指定一些系统参数减小内存占用,启动参数示例: - ``` + ```shell -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC 如:java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC cmrestapi-xxx.jar -e envFile ``` @@ -486,7 +486,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 1. 安装带cm的数据库集群,配置资源脚本和自定义资源文件,资源脚本示例如下: cmrestapi.sh - ``` + ```shell #!/bin/bash #set -ex #资源名称 @@ -571,7 +571,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 自定义资源文件cm_resource.json示例如下: - ``` + ```json { "resources": [ { @@ -693,14 +693,14 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 x86_64平台: - ``` + ```shell docker pull swr.cn-south-1.myhuaweicloud.com/mogdb/x86_64/mogdb:5.0.0 docker tag swr.cn-south-1.myhuaweicloud.com/mogdb/x86_64/mogdb:5.0.0 mogdb:5.0.0 ``` arm平台: - ``` + ```shell docker pull swr.cn-south-1.myhuaweicloud.com/mogdb/arm/mogdb:5.0.0 docker tag swr.cn-south-1.myhuaweicloud.com/mogdb/arm/mogdb:5.0.0 mogdb:5.0.0 ``` @@ -709,7 +709,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 如果多个容器部署在一台机器上,创建一个普通的容器网络即可: - ``` + ```shell docker network create --subnet=172.11.0.0/24 og-network ``` @@ -717,14 +717,14 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 选择一台部署progrium/consul容器: - ``` + ```shell docker pull progrium/consul docker run -d -p 8500:8500 -h consul --name consul progrium/consul -server -bootstrap ``` 每个节点的docker都进行修改: vim /usr/lib/systemd/system/docker.service 在ExecStart一栏后面追加: - ``` + ```shell -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --cluster-store=consul://192.168.0.94:8500 --cluster-advertise=eth0:2376 ``` @@ -732,20 +732,20 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 修改完成后需要重启docker: - ``` + ```shell systemctl daemon-reload systemctl restart docker ``` 创建overlay网络 - ``` + ```shell docker network create -d overlay --subnet 10.22.1.0/24 --gateway 10.22.1.1 og-network ``` 3. 启动多个容器实例 - ``` + ```shell # ip需要和容器网络在同一网段,几个实例的ip和节点名称不能重复。如下示例1主2备: primary_nodeip="172.11.0.2" @@ -772,19 +772,19 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 进入容器 - ``` + ```shell docker exec -ti /bin/bash su - omm ``` 查看集群状态 - ``` + ```shell cm_ctl query -Cvid ``` 连接接数据库 - ``` + ```shell gsql -d postgres -r ``` \ No newline at end of file diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md index f0ea36ee..2ec7a4dd 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md @@ -47,11 +47,11 @@ echo "集群用户名 ALL=(root) NOPASSWD: COMMAND_FLAG" >> /etc/sudoers 需要注意的是,由于需要动态绑定和解绑VIP,需要对网卡进行操作,因而需要对ifconfig进行提权,以允许集群用户能够使用sudo ifconfig方式绑定和解绑VIP。此操作可能带来窃听/篡改/仿冒/拒绝服务等安全风险,需谨慎使用。 -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)警告: -> -> 以上两条命令在每个节点上均只能执行一次,不能出现两次配置的情况,否则可能会造成`sudo ifconfig`命令报错。错误示例如下图所示: -> -> ![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) +![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)警告: + +以上两条命令在每个节点上均只能执行一次,不能出现两次配置的情况,否则可能会造成`sudo ifconfig`命令报错。错误示例如下图所示: + +![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) ### 3. 设置VIP资源文件 diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/feature-introduction.md b/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/feature-introduction.md index 4b97628a..17587374 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/feature-introduction.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/feature-introduction.md @@ -21,11 +21,11 @@ cm_agent是部署在数据库每个主机上,用来启停和监控各个数据 - 公共选项: - - -V, –version + - -V, --version 打印cm_agent版本信息,然后退出。 - - -?, -h,–help + - -?, -h,--help 显示关于cm_agent命令行参数的帮助信息,然后退出。 @@ -69,11 +69,11 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 - 公共选项: - - -V, –version + - -V, --version 打印cm_server版本信息,然后退出。 - - -?, -h,–help + - -?, -h,--help 显示关于cm_server命令行参数的帮助信息,然后退出。 @@ -151,7 +151,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 1. 资源脚本 主要用于指定资源的启停、状态检查等指令,一个样例如下: - ``` + ```shell #!/bin/bash #set -ex #取消该行注释可帮助调试脚本 #资源名称 @@ -242,9 +242,9 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 以上样例可以作为模板使用,用户主要需要修改的地方包括: 资源名称、资源binPath、用于过滤资源实例的命令关键词、用于保存首次检测到资源僵死时间的文件(可选)、最长僵死时间、记录首次僵死时间的变量名(如果同一节点存在多个不同的自定义资源实例) - 2. 自定义资源配置文件cm_resource.json 该文件位置为cmdir/cm_agent/cm_resource.json,配置该文件后需要重启集群 + 2. 自定义资源配置文件cm_resource.json,该文件位置为cmdir/cm_agent/cm_resource.json,配置该文件后需要重启集群 - ``` + ```json { "resources": [ { @@ -412,14 +412,14 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 1. ifconfig提权 修改权限文件/etc/sudoers,添加以下内容,为集群用户添加ifconfig权限。 - ````` + ```shell Cmnd_Alias COMMAND_FLAG = /usr/sbin/ifconfig 集群用户名 ALL=(root) NOPASSWD: COMMAND_FLAG - ````` + ``` 也可以缩小权限范围,例如: - ```javascript + ```shell Cmnd_Alias COMMAND_FLAG = /usr/sbin/ifconfig * netmask * up, /usr/sbin/ifconfig * down 集群用户名 ALL=(root) NOPASSWD: COMMAND_FLAG ``` @@ -660,7 +660,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 - -w 访问来源ip白名单,如果不需要设置白名单则可以不用指定。 启动命令: - ``` + ```shell java -jar cmrestapi-xxx.jar -e envFile [-w appWhiteList] ``` @@ -688,7 +688,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 (1) CMRestAPI默认使用http服务,支持配置访问白名单,可通过启动参数-w配置访问来源ip的白名单文件,白名单文件配置格式为每行一个ip地址; (2) 若要使用https服务,则可以在启动时jar包时指定系统参数server.ssl相关参数来是CMRestAPI启动https服务,或将相关参数写入application.properties文件然后在启动命令中指定配置文件,或配置源码resource目录下的application.properties文件然后自行编译,自定义配置参数示例: - ``` + ```shell -Dserver.port=服务监听端口 -Dserver.ssl.key-store=秘钥文件路径 -Dserver.ssl.key-store-password=秘钥文件密码 -Dserver.ssl.key-store-type=秘钥类型 如: 指定参数方式: @@ -704,7 +704,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 2. 内存相关。 由于本程序使用了springboot框架,默认启动会占用较大内存(约1G左右),若并发量不大不希望该程序占用较大内存,则可以在启动时指定一些系统参数减小内存占用,启动参数示例: - ``` + ```shell -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC 如:java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC cmrestapi-xxx.jar -e envFile ``` @@ -718,7 +718,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 1. 安装带cm的数据库集群,配置资源脚本和自定义资源文件,资源脚本示例如下: cmrestapi.sh - ``` + ```shell #!/bin/bash #set -ex #资源名称 @@ -803,7 +803,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 自定义资源文件cm_resource.json示例如下: - ``` + ```json { "resources": [ { @@ -925,14 +925,14 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 x86_64平台: - ``` + ```shell docker pull swr.cn-south-1.myhuaweicloud.com/mogdb/x86_64/mogdb:X.X.X docker tag swr.cn-south-1.myhuaweicloud.com/mogdb/x86_64/mogdb:X.X.X mogdb:X.X.X ``` arm平台: - ``` + ```shell docker pull swr.cn-south-1.myhuaweicloud.com/mogdb/arm/mogdb:X.X.X docker tag swr.cn-south-1.myhuaweicloud.com/mogdb/arm/mogdb:X.X.X mogdb:X.X.X ``` @@ -941,7 +941,7 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 如果多个容器部署在一台机器上,创建一个普通的容器网络即可: - ``` + ```shell docker network create --subnet=172.11.0.0/24 og-network ``` @@ -949,14 +949,14 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 选择一台部署progrium/consul容器: - ``` + ```shell docker pull progrium/consul docker run -d -p 8500:8500 -h consul --name consul progrium/consul -server -bootstrap ``` 每个节点的docker都进行修改: vim /usr/lib/systemd/system/docker.service 在ExecStart一栏后面追加: - ``` + ```shell -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --cluster-store=consul://192.168.0.94:8500 --cluster-advertise=eth0:2376 ``` @@ -964,20 +964,20 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 修改完成后需要重启docker: - ``` + ```shell systemctl daemon-reload systemctl restart docker ``` 创建overlay网络 - ``` + ```shell docker network create -d overlay --subnet 10.22.1.0/24 --gateway 10.22.1.1 og-network ``` 3. 启动多个容器实例 - ``` + ```shell # ip需要和容器网络在同一网段,几个实例的ip和节点名称不能重复。如下示例1主2备: primary_nodeip="172.11.0.2" @@ -1004,19 +1004,19 @@ cm_server是用来进行数据库实例管理和实例仲裁的组件。主要 进入容器 - ``` + ```shell docker exec -ti /bin/bash su - omm ``` 查看集群状态 - ``` + ```shell cm_ctl query -Cvid ``` 连接接数据库 - ``` + ```shell gsql -d postgres -r ``` \ No newline at end of file diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md b/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md index f0ea36ee..2ec7a4dd 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/cluster-management/manual-configuration-of-vip.md @@ -47,11 +47,11 @@ echo "集群用户名 ALL=(root) NOPASSWD: COMMAND_FLAG" >> /etc/sudoers 需要注意的是,由于需要动态绑定和解绑VIP,需要对网卡进行操作,因而需要对ifconfig进行提权,以允许集群用户能够使用sudo ifconfig方式绑定和解绑VIP。此操作可能带来窃听/篡改/仿冒/拒绝服务等安全风险,需谨慎使用。 -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)警告: -> -> 以上两条命令在每个节点上均只能执行一次,不能出现两次配置的情况,否则可能会造成`sudo ifconfig`命令报错。错误示例如下图所示: -> -> ![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) +![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-caution.gif)警告: + +以上两条命令在每个节点上均只能执行一次,不能出现两次配置的情况,否则可能会造成`sudo ifconfig`命令报错。错误示例如下图所示: + +![img](https://cdn-mogdb.enmotech.com/docs-media/mogdb/reference-guide/manual-configuration-of-vip-5.png) ### 3. 设置VIP资源文件 -- Gitee From d13b9b87a06507b3cae2fbe552cf2b1dadc82781 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Tue, 5 Dec 2023 15:14:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix(mogdb):gs=5Fcollector=E4=B8=ADbegin-tim?= =?UTF-8?q?e=E5=92=8Cend-time=E5=8F=82=E6=95=B0=E8=A1=A5=E5=85=85=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server-tools/4-gs_collector.md | 22 +++++++++---------- .../server-tools/4-gs_collector.md | 16 +++++++------- .../server-tools/4-gs_collector.md | 4 ++-- .../server-tools/4-gs_collector.md | 4 ++-- .../server-tools/gs_collector.md | 4 ++-- .../server-tools/gs_collector.md | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/server-tools/4-gs_collector.md b/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/server-tools/4-gs_collector.md index 88566c61..96fdb919 100644 --- a/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/server-tools/4-gs_collector.md +++ b/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/server-tools/4-gs_collector.md @@ -88,7 +88,7 @@ date: 2021-06-07 配置文件格式采用json格式,模板如下: - ``` + ```json { "Collect": [ @@ -99,7 +99,7 @@ date: 2021-06-07 > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 默认配置文件内容如下: { “Collect”: [ {“TypeName”: “System”, “Content”:“RunTimeInfo, HardWareInfo”,“Interval”:“0”, “Count”:“1”}, {“TypeName”: “Log”, “Content” : “DataNode,ClusterManager”, “Interval”:“0”, “Count”:“1”}, {“TypeName”: “Database”, “Content”: “pg_locks,pg_stat_activity,pg_thread_wait_status”,“Interval”:“0”, “Count”:“1”}, {“TypeName”: “Config”, “Content”: “DataNode”, “Interval”:“0”, “Count”:“1”} ] } TypeName和对应的Content取值范围见表1gs_collector内容收集对照表。 对于Log,CoreDump,Config,XLog四种类型,Interval和Count参数不生效。 -- -keyword=KEYWORD +- --keyword=KEYWORD 包含关键字KEYWORD的日志文件。 @@ -107,25 +107,25 @@ date: 2021-06-07 > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 性能日志为二进制日志,关键字搜集功能不支持该日志的搜集。 -- -begin-time +- --begin-time - 日志的开始时间。输入格式为“yyyymmdd hh:mm”。 + 日志的开始时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的最后修改时间小。 -- -end-time +- --end-time - 日志的结束时间。输入格式为“yyyymmdd hh:mm”。 + 日志的结束时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的创建时间大,且需大于--begin-time设置的时间。 -- -speed-limit +- --speed-limit 日志收集时的收集速率,输入格式为非负整数,单位为MB/s。 该参数主要是为了防止日志收集过程中产生过高的磁盘或网络IO,导致数据库节点故障(如果它们与\$GAUSSLOG/$PGHOST部署在同一个磁盘上)。该值应当不超过MogDB内上述磁盘IO与网络IO速率的最小值的1/3。 -- -?, -help +- -?, --help 显示帮助信息。 -- -V, -version +- -V, --version 显示版本号信息。 @@ -133,7 +133,7 @@ date: 2021-06-07 执行如下命令收集OS信息和日志信息。 -``` +```shell gs_collector --begin-time="20180131 23:00" --end-time="20180201 20:00" -h plat1 Successfully parsed the configuration file. create Dir. @@ -157,7 +157,7 @@ All results are stored in $PGHOST/collector_20200624_134541.tar.gz. 查看收集到的统计信息。 -``` +```shell tar -zxvf $PGHOST/collector_20200624_134541.tar.gz collector_20200624_134541/ collector_20200624_134541/plat1.tar.gz diff --git a/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/server-tools/4-gs_collector.md b/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/server-tools/4-gs_collector.md index 3f50fb2b..ca06510e 100644 --- a/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/server-tools/4-gs_collector.md +++ b/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/server-tools/4-gs_collector.md @@ -114,7 +114,7 @@ date: 2021-06-07 } ``` -- -keyword=KEYWORD +- --keyword=KEYWORD 包含关键字KEYWORD的日志文件。 @@ -122,25 +122,25 @@ date: 2021-06-07 > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 性能日志为二进制日志,关键字搜集功能不支持该日志的搜集。 -- -begin-time +- --begin-time - 日志的开始时间。输入格式为“yyyymmdd hh:mm”。 + 日志的开始时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的最后修改时间小。 -- -end-time +- --end-time - 日志的结束时间。输入格式为“yyyymmdd hh:mm”。 + 日志的结束时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的创建时间大,且需大于--begin-time设置的时间。 -- -speed-limit +- --speed-limit 日志收集时的收集速率,输入格式为非负整数,单位为MB/s。 该参数主要是为了防止日志收集过程中产生过高的磁盘或网络IO,导致数据库节点故障(如果它们与\$GAUSSLOG/$PGHOST部署在同一个磁盘上)。该值应当不超过MogDB内上述磁盘IO与网络IO速率的最小值的1/3。 -- -?, -help +- -?, --help 显示帮助信息。 -- -V, -version +- -V, --version 显示版本号信息。 diff --git a/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/server-tools/4-gs_collector.md b/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/server-tools/4-gs_collector.md index c8d3f815..fc86db8f 100644 --- a/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/server-tools/4-gs_collector.md +++ b/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/server-tools/4-gs_collector.md @@ -124,11 +124,11 @@ date: 2021-06-07 - --begin-time - 日志的开始时间。输入格式为“yyyymmdd hh:mm”。 + 日志的开始时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的最后修改时间小。 - --end-time - 日志的结束时间。输入格式为“yyyymmdd hh:mm”。 + 日志的结束时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的创建时间大,且需大于--begin-time设置的时间。 - --speed-limit diff --git a/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/server-tools/4-gs_collector.md b/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/server-tools/4-gs_collector.md index c8d3f815..fc86db8f 100644 --- a/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/server-tools/4-gs_collector.md +++ b/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/server-tools/4-gs_collector.md @@ -124,11 +124,11 @@ date: 2021-06-07 - --begin-time - 日志的开始时间。输入格式为“yyyymmdd hh:mm”。 + 日志的开始时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的最后修改时间小。 - --end-time - 日志的结束时间。输入格式为“yyyymmdd hh:mm”。 + 日志的结束时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的创建时间大,且需大于--begin-time设置的时间。 - --speed-limit diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/server-tools/gs_collector.md b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/server-tools/gs_collector.md index c8d3f815..fc86db8f 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/server-tools/gs_collector.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/server-tools/gs_collector.md @@ -124,11 +124,11 @@ date: 2021-06-07 - --begin-time - 日志的开始时间。输入格式为“yyyymmdd hh:mm”。 + 日志的开始时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的最后修改时间小。 - --end-time - 日志的结束时间。输入格式为“yyyymmdd hh:mm”。 + 日志的结束时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的创建时间大,且需大于--begin-time设置的时间。 - --speed-limit diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/server-tools/gs_collector.md b/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/server-tools/gs_collector.md index c8d3f815..fc86db8f 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/server-tools/gs_collector.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/tool-reference/server-tools/gs_collector.md @@ -124,11 +124,11 @@ date: 2021-06-07 - --begin-time - 日志的开始时间。输入格式为“yyyymmdd hh:mm”。 + 日志的开始时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的最后修改时间小。 - --end-time - 日志的结束时间。输入格式为“yyyymmdd hh:mm”。 + 日志的结束时间。输入格式为“yyyymmdd hh:mm”。该值需要比日志的创建时间大,且需大于--begin-time设置的时间。 - --speed-limit -- Gitee From c19944b0d2f0c4677df7ddd27680799fa235b36d Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Tue, 5 Dec 2023 16:37:50 +0800 Subject: [PATCH 5/6] fix(mogdb):broken links --- .../maintainability/extension-splitting.md | 134 +++++---- .../extension/orafce-user-guide.md | 270 ------------------ .../maintainability/extension-splitting.md | 18 +- .../extension/orafce-user-guide.md | 270 ------------------ .../1-connection-settings.md | 2 +- .../maintainability/extension-splitting.md | 18 +- .../transaction-ids-and-snapshots.md | 4 +- .../connection-settings.md | 2 +- .../maintainability/extension-splitting.md | 18 +- .../ndpplugin-extension-reference.md | 2 +- .../transaction-ids-and-snapshots.md | 4 +- .../connection-settings.md | 4 +- 12 files changed, 99 insertions(+), 647 deletions(-) delete mode 100644 product/en/docs-mogdb/v5.0/developer-guide/extension/orafce-user-guide.md delete mode 100644 product/en/docs-mogdb/v5.1/developer-guide/extension/orafce-user-guide.md diff --git a/product/en/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md b/product/en/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md index d51ea396..29f7d271 100644 --- a/product/en/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md +++ b/product/en/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md @@ -1,69 +1,67 @@ ---- -title: Extension Splitting -summary: Extension Splitting -author: Guo Huan -date: 2022-11-21 ---- - -# Extension Splitting - -## Availability - -This feature is available since MogDB 5.0.0. - -## Introduction - -In MogDB 5.0.0, extensions are independently developed. Each extension of the related version corresponding to the server package can be downloaded from the website, facilitating installation of the latest extension package and independent upgrade of each extension. - -Additionally, Dolphin MySQL is integrated into MogDB server and is not independently packaged. Users can create a database whose compatibility type is B without running any command. - -## Benefits - -MogDB version 5.0.0 extensions will be released independently so that users can obtain and install extensions individually. This means that you can selectively install and upgrade extensions according to your needs to meet your specific business requirements. - -In addition to this, we have also integrated the Dolphin MySQL Compatible extension, that allows users to use MogDB while enjoying the convenience of being compatible with MySQL. This means that you can operate MogDB with similar syntax and functionality as MySQL, without having to learn a new database language and features. In this way, you can migrate and manage your data more easily and enjoy the benefits of MogDB's high performance and reliability. - -## Description - -**Extension list**: - -1. [orafce](../../developer-guide/extension/orafce-user-guide.md): Oracle compatibility - -2. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md): data import in batches - -3. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md): data warm-up - -4. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md): unlock vacuum - -5. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md): spatial data extension - -6. [wal2json](../../developer-guide/extension/wal2json-user-guide.md): logical replication - -7. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md): homogeneous database connection - -8. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md): full-text search - -9. [whale](../../developer-guide/extension/whale.md): Oracle compatibility (MogDB version) - -**fdw**: - -1. [postgresql_fdw](../../developer-guide/extension/foreign-data-wrapper/3-postgres_fdw.md): supports PostgreSQL/openGauss. It uses the openGauss libpq package. - -2. [oracle_fdw](../../developer-guide/extension/foreign-data-wrapper/1-oracle_fdw.md): supports Oracle. It uses the Oracle 19c package, and supports the arm and x86 packages. - -3. [mysql_fdw](../../developer-guide/extension/foreign-data-wrapper/2-mysql_fdw.md): support MySQL. It uses the MySQL 8.0 client package. - -**The following extension will be released with server and is not packaged independently**: - -1. [Dolphin MySQL compatibility extension](../../developer-guide/mysql-compatibility-description/dolphin-extension/dolphin-overview.md) - -## Constraints - -1. For built-in extensions, Dolphin, whale, and db_link, and pg_trgm will be packaged with MogDB server since MogDB 3.1.0. -2. Hot-upgrade extension is not supported temporarily. -3. Uninstallation extension is not supported temporarily. -4. Extension naming rule: {Extension name}-{Community version of an extension}-{Version of MogDB server}-{Supported operating system}-{CPU architecture}.tar.gz - -## Related Pages - +--- +title: Extension Splitting +summary: Extension Splitting +author: Guo Huan +date: 2022-11-21 +--- + +# Extension Splitting + +## Availability + +This feature is available since MogDB 5.0.0. + +## Introduction + +In MogDB 5.0.0, extensions are independently developed. Each extension of the related version corresponding to the server package can be downloaded from the website, facilitating installation of the latest extension package and independent upgrade of each extension. + +Additionally, Dolphin MySQL is integrated into MogDB server and is not independently packaged. Users can create a database whose compatibility type is B without running any command. + +## Benefits + +MogDB version 5.0.0 extensions will be released independently so that users can obtain and install extensions individually. This means that you can selectively install and upgrade extensions according to your needs to meet your specific business requirements. + +In addition to this, we have also integrated the Dolphin MySQL Compatible extension, that allows users to use MogDB while enjoying the convenience of being compatible with MySQL. This means that you can operate MogDB with similar syntax and functionality as MySQL, without having to learn a new database language and features. In this way, you can migrate and manage your data more easily and enjoy the benefits of MogDB's high performance and reliability. + +## Description + +**Extension list**: + +1. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md): data import in batches + +2. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md): data warm-up + +3. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md): unlock vacuum + +4. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md): spatial data extension + +5. [wal2json](../../developer-guide/extension/wal2json-user-guide.md): logical replication + +6. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md): homogeneous database connection + +7. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md): full-text search + +8. [whale](../../developer-guide/extension/whale.md): Oracle compatibility (MogDB version) + +**fdw**: + +1. [postgresql_fdw](../../developer-guide/extension/foreign-data-wrapper/3-postgres_fdw.md): supports PostgreSQL/openGauss. It uses the openGauss libpq package. + +2. [oracle_fdw](../../developer-guide/extension/foreign-data-wrapper/1-oracle_fdw.md): supports Oracle. It uses the Oracle 19c package, and supports the arm and x86 packages. + +3. [mysql_fdw](../../developer-guide/extension/foreign-data-wrapper/2-mysql_fdw.md): support MySQL. It uses the MySQL 8.0 client package. + +**The following extension will be released with server and is not packaged independently**: + +1. [Dolphin MySQL compatibility extension](../../developer-guide/mysql-compatibility-description/dolphin-extension/dolphin-overview.md) + +## Constraints + +1. For built-in extensions, Dolphin, whale, and db_link, and pg_trgm will be packaged with MogDB server since MogDB 3.1.0. +2. Hot-upgrade extension is not supported temporarily. +3. Uninstallation extension is not supported temporarily. +4. Extension naming rule: {Extension name}-{Community version of an extension}-{Version of MogDB server}-{Supported operating system}-{CPU architecture}.tar.gz + +## Related Pages + [Extension Acquisition](https://www.mogdb.io/downloads/mogdb/) \ No newline at end of file diff --git a/product/en/docs-mogdb/v5.0/developer-guide/extension/orafce-user-guide.md b/product/en/docs-mogdb/v5.0/developer-guide/extension/orafce-user-guide.md deleted file mode 100644 index f2140f29..00000000 --- a/product/en/docs-mogdb/v5.0/developer-guide/extension/orafce-user-guide.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -title: orafce User Guide -summary: orafce User Guide -author: Guo Huan -date: 2021-11-29 ---- - -# orafce - -## orafce Overview - -orafce is MogDB compatibility package for Oracle, which can support some Oracle tables, functions, and data types. orafce provides functions and operators that emulate a subset of functions and packages from the Oracle RDBMS. - -This plugin contains some useful functions that can help with porting Oracle application to MogDB/PostgreSQL or that can be generally useful. Built-in Oracle date functions have been tested against Oracle 10 for conformance. Date ranges from 1960 to 2070 work correctly. Dates before 1100-03-01 cannot be verified due to a bug in Oracle. - -All functions are fully compatibles with Oracle and respect all known format strings. Detailed descriptions can be found on [GitHub orafce](https://github.com/orafce/orafce). - -
- -## Install orafce - -1. Access [Download page](https://www.mogdb.io/downloads/mogdb/) of the MogDB official website, download the orafce extension for the version you need. - -2. Unpack the package, for example: - - ```SHELL - tar -xzvf orafce-3.17-3.1.0-01-CentOS-x86_64.tar.gz - ``` - -3. Go to the directory where the extension is located and execute the `make install` command. - - ```SHELL - cd orafce/ - make install - ``` - -4. Connect to the database and execute the `create extension orafce;` to use it. - - ```sql - MogDB=# create extension orafce; - CREATE EXTENSION - ``` - -
- -## Create and Use orafce - -```sql -create extension orafce; -``` - -Check all schemas: - -```sql -\dn -``` - -
- -### dbms_output Use Method - -Check functions where some functions include parameters and some functions do not include parameters. The parameter type is boolean. - -```sql -\df dbms_output.* -``` - -Example of functions that do not include parameters: - -```sql -select dbms_output.disable(); -``` - -Example of functions that include parameters: - -```sql -select dbms_output.put_line('sss'); -``` - -Boolean: (here the value is 0 or 1) - -```sql -select dbms_output.serveroutput(0); -``` - -
- -### dbms_random Use Method - -Check functions where some functions include parameters and some functions do not include parameters. - -```sql -\df -``` - -Example of functions that include parameters: - -```sql -select dbms_random.initialize(1); -select dbms_random.value(256.1243434351237831823812312,12333.3111); -``` - -**Value** does not have to have the parameter value inputted. - -Example of functions that do not include parameters: - -```sql -select dbms_random.value(); -``` - -
- -### dbms_utility Use Method - -Check functions. - -```sql -\df -``` - -```sql -select dbms_utility.format_call_stack(); -select dbms_utility.format_call_stack('o'); -``` - -Only [ops] is allowed for functions that include parameters. - -```sql -select dbms_utility.get_time(); -``` - -
- -### oracle Function Usage - -Check functions. - -```sql -\df -``` - -```sql -select oracle.btrim('enmo'); -select oracle.get_full_version_num(); -select oracle.get_major_version(); -select oracle.get_major_version_num(); -select oracle.get_platform(); -select oracle.get_status(); -select oracle.length(1); -select oracle.lpad('enmo', 1); -select oracle.ltrim('enmo', 'enmo'); -select oracle.numtodsinterval(12.22,'1232'); -select oracle.nvl(1,2); -select oracle.regexp_count('enmo', 'tech'); -select oracle.regexp_instr('enmo', 'tech'); -select oracle.regexp_replace('enmo', 'tech', 'sss', 1); -select oracle.regexp_substr('enmo', 'tech', 1); -``` - -replace_empty_strings: - -```sql -CREATE TABLE trg_test(a varchar, b int, c varchar, d date, e int); -CREATE TRIGGER trg_test_xx BEFORE INSERT OR UPDATE ON trg_test FOR EACH ROW EXECUTE PROCEDURE oracle.replace_empty_strings(true); -\pset null *** -INSERT INTO trg_test VALUES('',10, 'AHOJ', NULL, NULL); -INSERT INTO trg_test VALUES('AHOJ', NULL, '', '2020-01-01', 100); -SELECT * FROM trg_test; -``` - -replace_null_strings: - -```sql -CREATE TABLE trg_test(a varchar, b int, c varchar, d date, e int); -CREATE TRIGGER trg_test_xx BEFORE INSERT OR UPDATE ON trg_test FOR EACH ROW EXECUTE PROCEDURE oracle.replace_null_strings(); -\pset null *** -INSERT INTO trg_test VALUES(NULL, 10, 'AHOJ', NULL, NULL); -INSERT INTO trg_test VALUES('AHOJ', NULL, NULL, '2020-01-01', 100); -SELECT * FROM trg_test; -``` - -```sql -SELECT * FROM trg_test; -select oracle.round(1.212, 1); -select oracle.rpad('enmo', 1); -select oracle.rtrim('yunhe', 'enmo'); -select oracle.sessiontimezone(); -select oracle.substr(111.122,1); -select oracle.to_char('14-Jan08 11:44:49+05:30'); -select oracle.translate_oracle_modifiers('icnsmx',true); -``` - -(The parameter must include one or more of 'icnsmx'. **m** will be converted to **n**, and **n** will be converted to **s**. If the parameter is set to **true**, **g** will be added to the end of the string. Otherwise, **g** is not added.) - -```sql -select oracle.trunc(122.31, 1); -select oracle.unistr('yunhe-enmo'); -``` - -
- -### utl_file Usage - -Check functions. - -```sql -\df -``` - -
- -### File Check Operation - -```sql -CREATE OR REPLACE FUNCTION checkFlushFile(dir text) RETURNS void AS $$ -DECLARE - f utl_file.file_type; - f1 utl_file.file_type; - ret_val text; - i integer; -BEGIN - f := utl_file.fopen(dir, 'regressflush_orafce.txt', 'a'); - PERFORM utl_file.put_line(f, 'ABC'); - PERFORM utl_file.new_line(f); - PERFORM utl_file.put_line(f, '123'::numeric); - PERFORM utl_file.new_line(f); - PERFORM utl_file.putf(f, '[1=%s, 2=%s, 3=%s, 4=%s, 5=%s]', '1', '2', '3', '4', '5'); - PERFORM utl_file.fflush(f); - f1 := utl_file.fopen(dir, 'regressflush_orafce.txt', 'r'); - ret_val=utl_file.get_nextline(f1); - i:=1; - WHILE ret_val IS NOT NULL LOOP - RAISE NOTICE '[%] >>%<<', i,ret_val; - ret_val := utl_file.get_nextline(f1); - i:=i+1; - END LOOP; - RAISE NOTICE '>>%<<', ret_val; - f1 := utl_file.fclose(f1); - f := utl_file.fclose(f); -END; -$$ LANGUAGE plpgsql -``` - -
- -### File Read Operation - -```sql -CREATE OR REPLACE FUNCTION read_file(dir text) RETURNS void AS $$ -DECLARE - f utl_file.file_type; -BEGIN - f := utl_file.fopen(dir, 'regress_orafce.txt', 'r'); - FOR i IN 1..11 LOOP - RAISE NOTICE '[%] >>%<<', i, utl_file.get_line(f); - END LOOP; - RAISE NOTICE '>>%<<', utl_file.get_line(f, 4); - RAISE NOTICE '>>%<<', utl_file.get_line(f, 4); - RAISE NOTICE '>>%<<', utl_file.get_line(f); - RAISE NOTICE '>>%<<', utl_file.get_line(f); - EXCEPTION - -- WHEN no_data_found THEN, 8.1 plpgsql doesn't know no_data_found - WHEN others THEN - RAISE NOTICE 'finish % ', sqlerrm; - RAISE NOTICE 'is_open = %', utl_file.is_open(f); - PERFORM utl_file.fclose_all(); - RAISE NOTICE 'is_open = %', utl_file.is_open(f); - END; -$$ LANGUAGE plpgsql; -``` diff --git a/product/en/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md b/product/en/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md index 4d957942..29f7d271 100644 --- a/product/en/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md +++ b/product/en/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md @@ -27,23 +27,21 @@ In addition to this, we have also integrated the Dolphin MySQL Compatible extens **Extension list**: -1. [orafce](../../developer-guide/extension/orafce-user-guide.md): Oracle compatibility +1. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md): data import in batches -2. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md): data import in batches +2. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md): data warm-up -3. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md): data warm-up +3. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md): unlock vacuum -4. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md): unlock vacuum +4. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md): spatial data extension -5. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md): spatial data extension +5. [wal2json](../../developer-guide/extension/wal2json-user-guide.md): logical replication -6. [wal2json](../../developer-guide/extension/wal2json-user-guide.md): logical replication +6. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md): homogeneous database connection -7. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md): homogeneous database connection +7. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md): full-text search -8. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md): full-text search - -9. [whale](../../developer-guide/extension/whale.md): Oracle compatibility (MogDB version) +8. [whale](../../developer-guide/extension/whale.md): Oracle compatibility (MogDB version) **fdw**: diff --git a/product/en/docs-mogdb/v5.1/developer-guide/extension/orafce-user-guide.md b/product/en/docs-mogdb/v5.1/developer-guide/extension/orafce-user-guide.md deleted file mode 100644 index f2140f29..00000000 --- a/product/en/docs-mogdb/v5.1/developer-guide/extension/orafce-user-guide.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -title: orafce User Guide -summary: orafce User Guide -author: Guo Huan -date: 2021-11-29 ---- - -# orafce - -## orafce Overview - -orafce is MogDB compatibility package for Oracle, which can support some Oracle tables, functions, and data types. orafce provides functions and operators that emulate a subset of functions and packages from the Oracle RDBMS. - -This plugin contains some useful functions that can help with porting Oracle application to MogDB/PostgreSQL or that can be generally useful. Built-in Oracle date functions have been tested against Oracle 10 for conformance. Date ranges from 1960 to 2070 work correctly. Dates before 1100-03-01 cannot be verified due to a bug in Oracle. - -All functions are fully compatibles with Oracle and respect all known format strings. Detailed descriptions can be found on [GitHub orafce](https://github.com/orafce/orafce). - -
- -## Install orafce - -1. Access [Download page](https://www.mogdb.io/downloads/mogdb/) of the MogDB official website, download the orafce extension for the version you need. - -2. Unpack the package, for example: - - ```SHELL - tar -xzvf orafce-3.17-3.1.0-01-CentOS-x86_64.tar.gz - ``` - -3. Go to the directory where the extension is located and execute the `make install` command. - - ```SHELL - cd orafce/ - make install - ``` - -4. Connect to the database and execute the `create extension orafce;` to use it. - - ```sql - MogDB=# create extension orafce; - CREATE EXTENSION - ``` - -
- -## Create and Use orafce - -```sql -create extension orafce; -``` - -Check all schemas: - -```sql -\dn -``` - -
- -### dbms_output Use Method - -Check functions where some functions include parameters and some functions do not include parameters. The parameter type is boolean. - -```sql -\df dbms_output.* -``` - -Example of functions that do not include parameters: - -```sql -select dbms_output.disable(); -``` - -Example of functions that include parameters: - -```sql -select dbms_output.put_line('sss'); -``` - -Boolean: (here the value is 0 or 1) - -```sql -select dbms_output.serveroutput(0); -``` - -
- -### dbms_random Use Method - -Check functions where some functions include parameters and some functions do not include parameters. - -```sql -\df -``` - -Example of functions that include parameters: - -```sql -select dbms_random.initialize(1); -select dbms_random.value(256.1243434351237831823812312,12333.3111); -``` - -**Value** does not have to have the parameter value inputted. - -Example of functions that do not include parameters: - -```sql -select dbms_random.value(); -``` - -
- -### dbms_utility Use Method - -Check functions. - -```sql -\df -``` - -```sql -select dbms_utility.format_call_stack(); -select dbms_utility.format_call_stack('o'); -``` - -Only [ops] is allowed for functions that include parameters. - -```sql -select dbms_utility.get_time(); -``` - -
- -### oracle Function Usage - -Check functions. - -```sql -\df -``` - -```sql -select oracle.btrim('enmo'); -select oracle.get_full_version_num(); -select oracle.get_major_version(); -select oracle.get_major_version_num(); -select oracle.get_platform(); -select oracle.get_status(); -select oracle.length(1); -select oracle.lpad('enmo', 1); -select oracle.ltrim('enmo', 'enmo'); -select oracle.numtodsinterval(12.22,'1232'); -select oracle.nvl(1,2); -select oracle.regexp_count('enmo', 'tech'); -select oracle.regexp_instr('enmo', 'tech'); -select oracle.regexp_replace('enmo', 'tech', 'sss', 1); -select oracle.regexp_substr('enmo', 'tech', 1); -``` - -replace_empty_strings: - -```sql -CREATE TABLE trg_test(a varchar, b int, c varchar, d date, e int); -CREATE TRIGGER trg_test_xx BEFORE INSERT OR UPDATE ON trg_test FOR EACH ROW EXECUTE PROCEDURE oracle.replace_empty_strings(true); -\pset null *** -INSERT INTO trg_test VALUES('',10, 'AHOJ', NULL, NULL); -INSERT INTO trg_test VALUES('AHOJ', NULL, '', '2020-01-01', 100); -SELECT * FROM trg_test; -``` - -replace_null_strings: - -```sql -CREATE TABLE trg_test(a varchar, b int, c varchar, d date, e int); -CREATE TRIGGER trg_test_xx BEFORE INSERT OR UPDATE ON trg_test FOR EACH ROW EXECUTE PROCEDURE oracle.replace_null_strings(); -\pset null *** -INSERT INTO trg_test VALUES(NULL, 10, 'AHOJ', NULL, NULL); -INSERT INTO trg_test VALUES('AHOJ', NULL, NULL, '2020-01-01', 100); -SELECT * FROM trg_test; -``` - -```sql -SELECT * FROM trg_test; -select oracle.round(1.212, 1); -select oracle.rpad('enmo', 1); -select oracle.rtrim('yunhe', 'enmo'); -select oracle.sessiontimezone(); -select oracle.substr(111.122,1); -select oracle.to_char('14-Jan08 11:44:49+05:30'); -select oracle.translate_oracle_modifiers('icnsmx',true); -``` - -(The parameter must include one or more of 'icnsmx'. **m** will be converted to **n**, and **n** will be converted to **s**. If the parameter is set to **true**, **g** will be added to the end of the string. Otherwise, **g** is not added.) - -```sql -select oracle.trunc(122.31, 1); -select oracle.unistr('yunhe-enmo'); -``` - -
- -### utl_file Usage - -Check functions. - -```sql -\df -``` - -
- -### File Check Operation - -```sql -CREATE OR REPLACE FUNCTION checkFlushFile(dir text) RETURNS void AS $$ -DECLARE - f utl_file.file_type; - f1 utl_file.file_type; - ret_val text; - i integer; -BEGIN - f := utl_file.fopen(dir, 'regressflush_orafce.txt', 'a'); - PERFORM utl_file.put_line(f, 'ABC'); - PERFORM utl_file.new_line(f); - PERFORM utl_file.put_line(f, '123'::numeric); - PERFORM utl_file.new_line(f); - PERFORM utl_file.putf(f, '[1=%s, 2=%s, 3=%s, 4=%s, 5=%s]', '1', '2', '3', '4', '5'); - PERFORM utl_file.fflush(f); - f1 := utl_file.fopen(dir, 'regressflush_orafce.txt', 'r'); - ret_val=utl_file.get_nextline(f1); - i:=1; - WHILE ret_val IS NOT NULL LOOP - RAISE NOTICE '[%] >>%<<', i,ret_val; - ret_val := utl_file.get_nextline(f1); - i:=i+1; - END LOOP; - RAISE NOTICE '>>%<<', ret_val; - f1 := utl_file.fclose(f1); - f := utl_file.fclose(f); -END; -$$ LANGUAGE plpgsql -``` - -
- -### File Read Operation - -```sql -CREATE OR REPLACE FUNCTION read_file(dir text) RETURNS void AS $$ -DECLARE - f utl_file.file_type; -BEGIN - f := utl_file.fopen(dir, 'regress_orafce.txt', 'r'); - FOR i IN 1..11 LOOP - RAISE NOTICE '[%] >>%<<', i, utl_file.get_line(f); - END LOOP; - RAISE NOTICE '>>%<<', utl_file.get_line(f, 4); - RAISE NOTICE '>>%<<', utl_file.get_line(f, 4); - RAISE NOTICE '>>%<<', utl_file.get_line(f); - RAISE NOTICE '>>%<<', utl_file.get_line(f); - EXCEPTION - -- WHEN no_data_found THEN, 8.1 plpgsql doesn't know no_data_found - WHEN others THEN - RAISE NOTICE 'finish % ', sqlerrm; - RAISE NOTICE 'is_open = %', utl_file.is_open(f); - PERFORM utl_file.fclose_all(); - RAISE NOTICE 'is_open = %', utl_file.is_open(f); - END; -$$ LANGUAGE plpgsql; -``` diff --git a/product/zh/docs-mogdb/v3.0/reference-guide/guc-parameters/3-connection-and-authentication/1-connection-settings.md b/product/zh/docs-mogdb/v3.0/reference-guide/guc-parameters/3-connection-and-authentication/1-connection-settings.md index 2f5b17a1..6f2ddd8c 100644 --- a/product/zh/docs-mogdb/v3.0/reference-guide/guc-parameters/3-connection-and-authentication/1-connection-settings.md +++ b/product/zh/docs-mogdb/v3.0/reference-guide/guc-parameters/3-connection-and-authentication/1-connection-settings.md @@ -192,7 +192,7 @@ Unix域套接字使用普通的Unix文件系统权限集。这个参数的值应 > - 空字符串,表示当前连接数据库的驱动不支持自动设置connection_info参数或应用程序未设置。 > - 驱动连接数据库的时候自行拼接的connection_info参数格式如下: > -> ```sql +> ``` > {"driver_name":"ODBC","driver_version": "(MogDB X.X.X build 56189e20) compiled at 2022-01-07 18:47:53 commit 0 last mr","driver_path":"/usr/local/lib/psqlodbcw.so","os_user":"omm"} > ``` > diff --git a/product/zh/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md b/product/zh/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md index 0c3bb912..1f9f94de 100644 --- a/product/zh/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md +++ b/product/zh/docs-mogdb/v5.0/characteristic-description/maintainability/extension-splitting.md @@ -27,23 +27,21 @@ MogDB 5.0.0版本的插件将独立发布,用户可以单独获取和安装插 **插件列表**: -1. [orafce](../../developer-guide/extension/orafce-user-guide.md):oracle兼容插件 +1. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md):数据批量导入插件 -2. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md):数据批量导入插件 +2. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md):数据预热插件 -3. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md):数据预热插件 +3. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md):无锁vacuum插件 -4. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md):无锁vacuum插件 +4. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md):空间数据插件 -5. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md):空间数据插件 +5. [wal2json](../../developer-guide/extension/wal2json-user-guide.md):逻辑复制插件 -6. [wal2json](../../developer-guide/extension/wal2json-user-guide.md):逻辑复制插件 +6. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md):同构数据库连接插件 -7. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md):同构数据库连接插件 +7. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md):全文搜索插件 -8. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md):全文搜索插件 - -9. [whale](../../developer-guide/extension/whale.md):Oracle兼容插件(MogDB版,非openGauss版) +8. [whale](../../developer-guide/extension/whale.md):Oracle兼容插件(MogDB版,非openGauss版) **fdw类**: diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md b/product/zh/docs-mogdb/v5.0/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md index ab029cdf..9b575993 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md @@ -29,7 +29,7 @@ txid_snapshot的文本表示为:xmin:xmax:xip_list。 返回类型:bigint -- gs\_txid\_oldestxmin\(\) +- gs_txid_oldestxmin 描述:获取当前最小事务id的值oldesxmin。 @@ -198,7 +198,7 @@ txid_snapshot的文本表示为:xmin:xmax:xip_list。 - pg_shared_memory_detail - 描述:返回所有已产生的共享内存上下文的使用信息,各列描述请参考[GS_SHARED_MEMORY_DETAIL](../../../reference-guide/schema/DBE_PERF/memory/GS_SHARED_MEMORY_DETAIL.md)。 + 描述:返回所有已产生的共享内存上下文的使用信息,各列描述请参考[GS_SHARED_MEMORY_DETAIL](../../../reference-guide/system-catalogs-and-system-views/system-views/GS_SHARED_MEMORY_DETAIL.md)。 参数:nan diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md b/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md index c62939ab..23b3f383 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md @@ -206,7 +206,7 @@ Unix域套接字使用普通的Unix文件系统权限集。这个参数的值应 > - 空字符串,表示当前连接数据库的驱动不支持自动设置connection_info参数或应用程序未设置。 > - 驱动连接数据库的时候自行拼接的connection_info参数格式如下: > -> ```sql +> ``` > {"driver_name":"ODBC","driver_version": "(MogDB X.X.X build 56189e20) compiled at 2022-01-07 18:47:53 commit 0 last mr","driver_path":"/usr/local/lib/psqlodbcw.so","os_user":"omm"} > ``` > diff --git a/product/zh/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md b/product/zh/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md index 0c3bb912..1f9f94de 100644 --- a/product/zh/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md +++ b/product/zh/docs-mogdb/v5.1/characteristic-description/maintainability/extension-splitting.md @@ -27,23 +27,21 @@ MogDB 5.0.0版本的插件将独立发布,用户可以单独获取和安装插 **插件列表**: -1. [orafce](../../developer-guide/extension/orafce-user-guide.md):oracle兼容插件 +1. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md):数据批量导入插件 -2. [pg_bulkload](../../developer-guide/extension/pg_bulkload-user-guide.md):数据批量导入插件 +2. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md):数据预热插件 -3. [pg_prewarm](../../developer-guide/extension/pg_prewarm-user-guide.md):数据预热插件 +3. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md):无锁vacuum插件 -4. [pg_repack](../../developer-guide/extension/pg_repack-user-guide.md):无锁vacuum插件 +4. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md):空间数据插件 -5. [PostGIS](../../developer-guide/extension/postgis-extension/postgis-overview.md):空间数据插件 +5. [wal2json](../../developer-guide/extension/wal2json-user-guide.md):逻辑复制插件 -6. [wal2json](../../developer-guide/extension/wal2json-user-guide.md):逻辑复制插件 +6. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md):同构数据库连接插件 -7. [db_link](../../developer-guide/extension/foreign-data-wrapper/dblink.md):同构数据库连接插件 +7. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md):全文搜索插件 -8. [pg_trgm](../../developer-guide/extension/pg_trgm-user-guide.md):全文搜索插件 - -9. [whale](../../developer-guide/extension/whale.md):Oracle兼容插件(MogDB版,非openGauss版) +8. [whale](../../developer-guide/extension/whale.md):Oracle兼容插件(MogDB版,非openGauss版) **fdw类**: diff --git a/product/zh/docs-mogdb/v5.1/developer-guide/extension/ndpplugin-extension/ndpplugin-extension-reference/ndpplugin-extension-reference.md b/product/zh/docs-mogdb/v5.1/developer-guide/extension/ndpplugin-extension/ndpplugin-extension-reference/ndpplugin-extension-reference.md index 8cc2ca31..b03ad76a 100644 --- a/product/zh/docs-mogdb/v5.1/developer-guide/extension/ndpplugin-extension/ndpplugin-extension-reference/ndpplugin-extension-reference.md +++ b/product/zh/docs-mogdb/v5.1/developer-guide/extension/ndpplugin-extension/ndpplugin-extension-reference/ndpplugin-extension-reference.md @@ -7,5 +7,5 @@ date: 2023-11-21 # NDPPlugin参考 -- **[系统视图](./ndpplugin-extension-view)** +- **[系统视图](./ndpplugin-extension-view.md)** - **[GUC参数说明](./ndpplugin-extension-guc-parameters.md)** diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md b/product/zh/docs-mogdb/v5.1/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md index ab029cdf..9b575993 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/functions-and-operators/system-information-functions/transaction-ids-and-snapshots.md @@ -29,7 +29,7 @@ txid_snapshot的文本表示为:xmin:xmax:xip_list。 返回类型:bigint -- gs\_txid\_oldestxmin\(\) +- gs_txid_oldestxmin 描述:获取当前最小事务id的值oldesxmin。 @@ -198,7 +198,7 @@ txid_snapshot的文本表示为:xmin:xmax:xip_list。 - pg_shared_memory_detail - 描述:返回所有已产生的共享内存上下文的使用信息,各列描述请参考[GS_SHARED_MEMORY_DETAIL](../../../reference-guide/schema/DBE_PERF/memory/GS_SHARED_MEMORY_DETAIL.md)。 + 描述:返回所有已产生的共享内存上下文的使用信息,各列描述请参考[GS_SHARED_MEMORY_DETAIL](../../../reference-guide/system-catalogs-and-system-views/system-views/GS_SHARED_MEMORY_DETAIL.md)。 参数:nan diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md b/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md index b91b8f3f..c035a8ae 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/connection-and-authentication/connection-settings.md @@ -216,7 +216,7 @@ Unix域套接字使用普通的Unix文件系统权限集。这个参数的值应 > - 空字符串,表示当前连接数据库的驱动不支持自动设置connection_info参数或应用程序未设置。 > - 驱动连接数据库的时候自行拼接的connection_info参数格式如下: > -> ```sql +> ``` > {"driver_name":"ODBC","driver_version": "(MogDB X.X.X build 56189e20) compiled at 2022-01-07 18:47:53 commit 0 last mr","driver_path":"/usr/local/lib/psqlodbcw.so","os_user":"omm"} > ``` > @@ -258,7 +258,7 @@ Unix域套接字使用普通的Unix文件系统权限集。这个参数的值应 ## b_compatibility_user_host_auth -**参数说明**:控制是否允许创建user@host、'user'@'host'之类的用户并兼容mysql的user@host认证鉴权,对兼容mysql的user@host进行认证时,需要在配置文件postgresql.conf中设为on。 +**参数说明**:控制是否允许创建`user@host`、`'user'@'host'`之类的用户并兼容mysql的`user@host`认证鉴权,对兼容mysql的`user@host`进行认证时,需要在配置文件postgresql.conf中设为on。 **取值范围**:布尔型 -- Gitee From 5ca59b0b3bc65142b6c74ac43a107e0315e6263f Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Tue, 5 Dec 2023 17:06:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix(mogdb):=E5=BD=92=E6=A1=A3=E7=B1=BB?= =?UTF-8?q?=E5=8F=82=E6=95=B0archive=5Finterval=E5=92=8Carchive=5Ftimeout?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write-ahead-log/archiving.md | 188 +++++++++--------- .../write-ahead-log/archiving.md | 2 + .../write-ahead-log/archiving.md | 4 +- .../write-ahead-log/archiving.md | 4 +- 4 files changed, 103 insertions(+), 95 deletions(-) diff --git a/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md b/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md index 67d4c4f1..291d5cfc 100644 --- a/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md +++ b/product/en/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md @@ -1,93 +1,95 @@ ---- -title: Archiving -summary: Archiving -author: Zhang Cuiping -date: 2021-04-20 ---- - -# Archiving - -## archive_mode - -**Parameter description**: Specifies whether to archive WALs. - -This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). - -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** -> -> When **wal_level** is set to **minimal**, the **archive_mode** parameter is unavailable. - -**Value range**: Boolean - -- **on** indicates that the archiving is enabled. -- **off** indicates that the archiving is disabled. - -**Default value**: **off** - -## archive_command - -**Parameter description:** Specifies the command set by the administrator to archive WALs. You are advised to set the archive log path to an absolute path. - -This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). - -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** -> -> - If both **archive_dest** and **archive_command**are configured, WALs are preferentially saved to the directory specified by **archive_dest**. The command configured by **archive_command**does not take effect. -> -> - Any **%p** in the string is replaced by the absolute path of the file to archive, and any **%f** is replaced by only the file name. (The relative path is relative to the data directory.) Use **%%** to embed an actual **%** character in the command. -> - This command returns zero only if it succeeds. The following shows the command: -> -> ``` -> archive_command = 'cp --remove-destination %p /mnt/server/archivedir/%f' -> ``` -> -> - **--remove-destination** indicates that files will be overwritten during the archiving. -> -> - If there are multiple archive commands, write them to the shell script file and set **archive_command**to the command for executing the script. For example: -> -> ```shell -> -- Assume that multiple commands are as follows: -> test ! -f dir/%f && cp %p dir/%f -> -- The content of the test.sh script is as follows: -> test ! -f dir/$2 && cp $1 dir/$2 -> -- The archive command is as follows: -> archive_command='sh dir/test.sh %p %f' -> ``` - -**Value range**: a string - -**Default value:** **(disabled)** - -## archive_dest - -**Parameter description:** Specifies the path set by the administrator to archive WALs. You are advised to set the archive log path to an absolute path. - -This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). - -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** -> -> - If both **archive_dest** and **archive_command**are configured, WALs are preferentially saved to the directory specified by **archive_dest**. The command configured by **archive_command**does not take effect. -> - If the string is a relative path, it is relative to the data directory. The following is an example: -> -> ``` -> archive_dest = '/mnt/server/archivedir/' -> ``` - -**Value range**: a string - -**Default value**: an empty string - -## archive_timeout - -**Parameter description**: Specifies the archiving period. - -This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). - -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** -> -> - The server is forced to switch to a new WAL segment file when the period specified by this parameter has elapsed since the last file switch. -> - Archived files that are closed early due to a forced switch are still of the same length as full files. Therefore, a very short **archive_timeout** will bloat the archive storage. You are advised to set **archive_timeout** to **60s**. - -**Value range**: an integer ranging from 0 to *INT_MAX*. The unit is second. **0** indicates that archiving timeout is disabled. - -**Default value**: **0** +--- +title: Archiving +summary: Archiving +author: Zhang Cuiping +date: 2021-04-20 +--- + +# Archiving + +## archive_mode + +**Parameter description**: Specifies whether to archive WALs. + +This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). + +> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** +> +> When **wal_level** is set to **minimal**, the **archive_mode** parameter is unavailable. + +**Value range**: Boolean + +- **on** indicates that the archiving is enabled. +- **off** indicates that the archiving is disabled. + +**Default value**: **off** + +## archive_command + +**Parameter description:** Specifies the command set by the administrator to archive WALs. You are advised to set the archive log path to an absolute path. + +This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). + +> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** +> +> - If both **archive_dest** and **archive_command**are configured, WALs are preferentially saved to the directory specified by **archive_dest**. The command configured by **archive_command**does not take effect. +> +> - Any **%p** in the string is replaced by the absolute path of the file to archive, and any **%f** is replaced by only the file name. (The relative path is relative to the data directory.) Use **%%** to embed an actual **%** character in the command. +> - This command returns zero only if it succeeds. The following shows the command: +> +> ``` +> archive_command = 'cp --remove-destination %p /mnt/server/archivedir/%f' +> ``` +> +> - **--remove-destination** indicates that files will be overwritten during the archiving. +> +> - If there are multiple archive commands, write them to the shell script file and set **archive_command**to the command for executing the script. For example: +> +> ```shell +> -- Assume that multiple commands are as follows: +> test ! -f dir/%f && cp %p dir/%f +> -- The content of the test.sh script is as follows: +> test ! -f dir/$2 && cp $1 dir/$2 +> -- The archive command is as follows: +> archive_command='sh dir/test.sh %p %f' +> ``` + +**Value range**: a string + +**Default value:** **(disabled)** + +## archive_dest + +**Parameter description:** Specifies the path set by the administrator to archive WALs. You are advised to set the archive log path to an absolute path. + +This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). + +> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** +> +> - If both **archive_dest** and **archive_command**are configured, WALs are preferentially saved to the directory specified by **archive_dest**. The command configured by **archive_command**does not take effect. +> - If the string is a relative path, it is relative to the data directory. The following is an example: +> +> ``` +> archive_dest = '/mnt/server/archivedir/' +> ``` + +**Value range**: a string + +**Default value**: an empty string + +## archive_timeout + +**Parameter description**: Specifies the archiving period. + +archive_timeout is suitable for scenarios where active-standby streaming replication is not used or where WAL logs need to be archived. By default, file switching will occur when WAL reaches a certain size, and archiving can copy WAL files at this time. When the system is idle, some WAL logs may remain in the memory and cannot be archived in time. After archive_timeout is set to greater than 0, the system will force the WAL content in the memory to be flushed to the disk when the set value is exceeded to achieve timely archiving of WAL logs. + +This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). + +> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** +> +> - The server is forced to switch to a new WAL segment file when the period specified by this parameter has elapsed since the last file switch. +> - Archived files that are closed early due to a forced switch are still of the same length as full files. Therefore, a very short **archive_timeout** will bloat the archive storage. You are advised to set **archive_timeout** to **60s**. + +**Value range**: an integer ranging from 0 to *INT_MAX*. The unit is second. **0** indicates that archiving timeout is disabled. + +**Default value**: **0** diff --git a/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md b/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md index 54d073a8..291d5cfc 100644 --- a/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md +++ b/product/en/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md @@ -81,6 +81,8 @@ This parameter is a SIGHUP parameter. Set it based on instructions provided in T **Parameter description**: Specifies the archiving period. +archive_timeout is suitable for scenarios where active-standby streaming replication is not used or where WAL logs need to be archived. By default, file switching will occur when WAL reaches a certain size, and archiving can copy WAL files at this time. When the system is idle, some WAL logs may remain in the memory and cannot be archived in time. After archive_timeout is set to greater than 0, the system will force the WAL content in the memory to be flushed to the disk when the set value is exceeded to achieve timely archiving of WAL logs. + This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 [GUC parameters](../../../reference-guide/guc-parameters/appendix.md). > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **NOTICE:** diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md b/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md index 60fb3551..907fdf9d 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/write-ahead-log/archiving.md @@ -83,6 +83,8 @@ date: 2021-04-20 **参数说明**: 表示归档周期。 +archive_timeout适用于未使用主备流式复制或者需要对WAL日志进行归档的场景,默认情况下,WAL达到一定大小会进行文件切换,归档此时能将WAL文件复制过去。系统空闲时可能导致部分WAL日志一直留在内存中,无法及时被归档。archive_timeout设置为大于0后,系统会在超过设定值时强制将内存中的WAL内容刷到磁盘上,以实现WAL日志及时归档。 + 该参数属于SIGHUP类型参数,请参考表[GUC参数分类](../../../reference-guide/guc-parameters/appendix.md)中对应设置方法进行设置。 > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **须知**: @@ -96,7 +98,7 @@ date: 2021-04-20 ## archive_interval -**参数说明**:表示归档间隔时间。 +**参数说明**:表示归档间隔时间。此参数只针对分布式和备机归档生效,目前不投入使用。 该参数属于SIGHUP类型参数,请参考[GUC参数分类](../../../reference-guide/guc-parameters/appendix.md)中对应设置方法进行设置。 diff --git a/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md b/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md index 60fb3551..907fdf9d 100644 --- a/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md +++ b/product/zh/docs-mogdb/v5.1/reference-guide/guc-parameters/write-ahead-log/archiving.md @@ -83,6 +83,8 @@ date: 2021-04-20 **参数说明**: 表示归档周期。 +archive_timeout适用于未使用主备流式复制或者需要对WAL日志进行归档的场景,默认情况下,WAL达到一定大小会进行文件切换,归档此时能将WAL文件复制过去。系统空闲时可能导致部分WAL日志一直留在内存中,无法及时被归档。archive_timeout设置为大于0后,系统会在超过设定值时强制将内存中的WAL内容刷到磁盘上,以实现WAL日志及时归档。 + 该参数属于SIGHUP类型参数,请参考表[GUC参数分类](../../../reference-guide/guc-parameters/appendix.md)中对应设置方法进行设置。 > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **须知**: @@ -96,7 +98,7 @@ date: 2021-04-20 ## archive_interval -**参数说明**:表示归档间隔时间。 +**参数说明**:表示归档间隔时间。此参数只针对分布式和备机归档生效,目前不投入使用。 该参数属于SIGHUP类型参数,请参考[GUC参数分类](../../../reference-guide/guc-parameters/appendix.md)中对应设置方法进行设置。 -- Gitee