diff --git "a/content/zh/post/duomibabi/openGauss1-0-1\346\224\257\346\214\201docker\344\270\273\345\244\207\346\220\255\345\273\272.md" "b/content/zh/post/duomibabi/openGauss1-0-1\346\224\257\346\214\201docker\344\270\273\345\244\207\346\220\255\345\273\272.md"
new file mode 100644
index 0000000000000000000000000000000000000000..ed196a782d0e2c019573619db978c55b3403339b
--- /dev/null
+++ "b/content/zh/post/duomibabi/openGauss1-0-1\346\224\257\346\214\201docker\344\270\273\345\244\207\346\220\255\345\273\272.md"
@@ -0,0 +1,307 @@
++++
+
+title = "openGauss1.0.1支持docker主备搭建"
+
+date = "2020-11-19"
+
+tags = ["openGauss1.0.1支持docker主备搭建"]
+
+archives = "2020-11"
+
+author = "多米爸比"
+
+summary = "openGauss1.0.1支持docker主备搭建"
+
+img = "/zh/post/duomibabi/title/title.png"
+
+times = "17:30"
+
++++
+
+# openGauss1.0.1支持docker主备搭建
+
+目前已经支持x86-64和ARM64两种架构。
+
+x86-64架构的openGuass运行在CentOS 7.6操作系统中。
+
+ARM64架构的openGauss运行在openEuler 20.03 LTS操作系统中。
+
+## 快速搭建环境
+
+### pull镜像文件
+
+```
+docker pull enmotech/opengauss:1.0.1
+```
+
+### 创建自定义网络,创建容器便于使用固定IP
+
+```
+docker network create --subnet=172.18.0.0/16 myNetwork
+```
+
+### 创建主库容器并运行
+
+```
+docker run --name op_master \
+--network myNetwork --ip 172.18.0.10 --privileged=true \
+--hostname op_master --detach \
+--env GS_PORT=6432 \
+--env OG_SUBNET=172.18.0.0/16 \
+--env GS_PASSWORD=Enmotech@2020 \
+--env NODE_NAME=op_master \
+--env REPL_CONN_INFO="replconninfo1 = 'localhost=172.18.0.10 localport=6439 localservice=6432 remotehost=172.18.0.11 remoteport=6439 remoteservice=6432 '\n" \
+--cpuset-cpus="1,3" \
+opengauss:1.0.1 -M primary
+```
+
+### 创建备库容器并运行
+
+```
+docker run --name op_slave_one \
+--network myNetwork --ip 172.18.0.11 --privileged=true \
+--hostname op_slave_one --detach \
+--env GS_PORT=6432 \
+--env OG_SUBNET=172.18.0.0/16 \
+--env GS_PASSWORD=Enmotech@2020 \
+--env NODE_NAME=op_slave_one \
+--env REPL_CONN_INFO="replconninfo1 = 'localhost=172.18.0.11 localport=6439 localservice=6432 remotehost=172.18.0.10 remoteport=6439 remoteservice=6432 '\n" \
+--cpuset-cpus="2,4" \
+opengauss:1.0.1 -M standby
+```
+
+说明:可以参考[官方镜像脚本](https://hub.docker.com/r/enmotech/opengauss)来创建localport与localservice端口间隔要大于2,对外映射端口为localservice。
+
+## 查询主备角色状态
+
+### 查询命令
+
+```
+gs_ctl query -D /var/lib/opengauss/data/
+```
+
+### 主库op\_master查询
+
+```
+docker exec -it op_master bash
+
+[omm@op_master ~]$ gs_ctl query -D /var/lib/opengauss/data/
+[2020-10-20 13:50:39.163][666][][gs_ctl]: gs_ctl query ,datadir is -D "/var/lib/opengauss/data"
+ HA state:
+ local_role : Primary
+ static_connections : 1
+ db_state : Normal
+ detail_information : Normal
+
+ Senders info:
+ sender_pid : 637
+ local_role : Primary
+ peer_role : Standby
+ peer_state : Normal
+ state : Streaming
+ sender_sent_location : 0/5000238
+ sender_write_location : 0/5000238
+ sender_flush_location : 0/5000238
+ sender_replay_location : 0/5000238
+ receiver_received_location : 0/5000238
+ receiver_write_location : 0/5000238
+ receiver_flush_location : 0/5000238
+ receiver_replay_location : 0/5000238
+ sync_percent : 100%
+ sync_state : Sync
+ sync_priority : 1
+ sync_most_available : On
+ channel : 172.18.0.10:6439-->172.18.0.11:55440
+
+ Receiver info:
+No information
+```
+
+### 备库op\_slave\_one查询
+
+```
+docker exec -it op_slave_one bash
+
+[omm@op_slave_one ~]$ gs_ctl query -D /var/lib/opengauss/data/
+[2020-10-20 13:51:24.640][460][][gs_ctl]: gs_ctl query ,datadir is -D "/var/lib/opengauss/data"
+ HA state:
+ local_role : Standby
+ static_connections : 1
+ db_state : Normal
+ detail_information : Normal
+
+ Senders info:
+No information
+ Receiver info:
+ receiver_pid : 401
+ local_role : Standby
+ peer_role : Primary
+ peer_state : Normal
+ state : Normal
+ sender_sent_location : 0/5000238
+ sender_write_location : 0/5000238
+ sender_flush_location : 0/5000238
+ sender_replay_location : 0/5000238
+ receiver_received_location : 0/5000238
+ receiver_write_location : 0/5000238
+ receiver_flush_location : 0/5000238
+ receiver_replay_location : 0/5000238
+ sync_percent : 100%
+ channel : 172.18.0.11:55440<--172.18.0.10:6439
+```
+
+说明:从上面主库Senders信息和备库Receiver可以看到主备状态正常。
+
+## 读写及切换测试
+
+### 主库op\_master写测试
+
+```
+[omm@op_master ~]$ gsql -p6432
+gsql ((openGauss 1.0.1 build e9da9fb9) compiled at 2020-10-01 20:21:42 commit 0 last mr )
+Non-SSL connection (SSL connection is recommended when requiring high-security)
+Type "help" for help.
+
+omm=# create table t(id json);
+CREATE TABLE
+omm=# insert into t values('{"name":"Mr.D"}');
+INSERT 0 1
+```
+
+### 备库op\_slave\_one读测试
+
+```
+[omm@op_slave_one ~]$ gsql -p6432
+gsql ((openGauss 1.0.1 build e9da9fb9) compiled at 2020-10-01 20:21:42 commit 0 last mr )
+Non-SSL connection (SSL connection is recommended when requiring high-security)
+Type "help" for help.
+
+omm=# select * from t;
+ id
+-----------------
+ {"name":"Mr.D"}
+(1 row)
+
+omm=# delete from t;
+ERROR: cannot execute DELETE in a read-only transaction
+```
+
+### 切换测试:将op\_slave\_one 切换为主库,op\_master 切换为备库
+
+**op\_slave\_one执行switchover**
+
+```
+[omm@op_slave_one ~]$ gs_ctl switchover -D /var/lib/opengauss/data/
+[2020-10-20 13:57:02.877][504][][gs_ctl]: gs_ctl switchover ,datadir is -D "/var/lib/opengauss/data"
+[2020-10-20 13:57:02.877][504][][gs_ctl]: switchover term (1)
+[2020-10-20 13:57:02.888][504][][gs_ctl]: waiting for server to switchover.........
+[2020-10-20 13:57:08.920][504][][gs_ctl]: done
+[2020-10-20 13:57:08.920][504][][gs_ctl]: switchover completed (/var/lib/opengauss/data)
+```
+
+**op\_slave\_one查询状态**
+
+```
+[omm@op_slave_one ~]$ gs_ctl query -D /var/lib/opengauss/data/
+[2020-10-20 13:58:13.340][555][][gs_ctl]: gs_ctl query ,datadir is -D "/var/lib/opengauss/data"
+ HA state:
+ local_role : Primary
+ static_connections : 1
+ db_state : Normal
+ detail_information : Normal
+
+ Senders info:
+ sender_pid : 523
+ local_role : Primary
+ peer_role : Standby
+ peer_state : Normal
+ state : Streaming
+ sender_sent_location : 0/5004A10
+ sender_write_location : 0/5004A10
+ sender_flush_location : 0/5004A10
+ sender_replay_location : 0/5004A10
+ receiver_received_location : 0/5004A10
+ receiver_write_location : 0/5004A10
+ receiver_flush_location : 0/5004A10
+ receiver_replay_location : 0/5004A10
+ sync_percent : 100%
+ sync_state : Sync
+ sync_priority : 1
+ sync_most_available : On
+ channel : 172.18.0.11:6439-->172.18.0.10:39314
+
+ Receiver info:
+No information
+```
+
+**op\_master查询状态**
+
+```
+[omm@op_master ~]$ gs_ctl query -D /var/lib/opengauss/data/
+[2020-10-20 13:58:42.827][743][][gs_ctl]: gs_ctl query ,datadir is -D "/var/lib/opengauss/data"
+ HA state:
+ local_role : Standby
+ static_connections : 1
+ db_state : Normal
+ detail_information : Normal
+
+ Senders info:
+No information
+ Receiver info:
+ receiver_pid : 739
+ local_role : Standby
+ peer_role : Primary
+ peer_state : Normal
+ state : Normal
+ sender_sent_location : 0/5004A10
+ sender_write_location : 0/5004A10
+ sender_flush_location : 0/5004A10
+ sender_replay_location : 0/5004A10
+ receiver_received_location : 0/5004A10
+ receiver_write_location : 0/5004A10
+ receiver_flush_location : 0/5004A10
+ receiver_replay_location : 0/5004A10
+ sync_percent : 100%
+ channel : 172.18.0.10:39314<--172.18.0.11:6439
+```
+
+可以看到 op\_master变为备库,op\_slave\_one变为主库,切换成功。
+
+**数据读写验证**
+
+主库op\_slave\_one做写入验证。
+
+```
+[omm@op_slave_one ~]$ gsql -p6432
+gsql ((openGauss 1.0.1 build e9da9fb9) compiled at 2020-10-01 20:21:42 commit 0 last mr )
+Non-SSL connection (SSL connection is recommended when requiring high-security)
+Type "help" for help.
+
+omm=# select * from t;
+ id
+-----------------
+ {"name":"Mr.D"}
+(1 row)
+
+omm=# insert into t values('{"name":"insert from op_slave_one "}');
+INSERT 0 1
+```
+
+备库op\_master做读取验证。
+
+```
+[omm@op_master ~]$ gsql -p6432
+gsql ((openGauss 1.0.1 build e9da9fb9) compiled at 2020-10-01 20:21:42 commit 0 last mr )
+Non-SSL connection (SSL connection is recommended when requiring high-security)
+Type "help" for help.
+
+omm=# select * from t;
+ id
+--------------------------------------
+ {"name":"Mr.D"}
+ {"name":"insert from op_slave_one "}
+(2 rows)
+
+omm=# delete from t;
+ERROR: cannot execute DELETE in a read-only transaction
+```
diff --git "a/content/zh/post/duomibabi/openGauss1-0-1\346\224\257\346\214\201oracle-fdw\345\222\214mysql-fdw.md" "b/content/zh/post/duomibabi/openGauss1-0-1\346\224\257\346\214\201oracle-fdw\345\222\214mysql-fdw.md"
new file mode 100644
index 0000000000000000000000000000000000000000..07ddb3df6ad4b3f6d41afef5b98e099e19828016
--- /dev/null
+++ "b/content/zh/post/duomibabi/openGauss1-0-1\346\224\257\346\214\201oracle-fdw\345\222\214mysql-fdw.md"
@@ -0,0 +1,299 @@
++++
+
+title = "openGauss1.0.1支持oracle-fdw和mysql-fdw"
+
+date = "2020-11-19"
+
+tags = ["openGauss1.0.1支持oracle-fdw和mysql-fdw"]
+
+archives = "2020-11"
+
+author = "多米爸比"
+
+summary = "openGauss1.0.1支持oracle-fdw和mysql-fdw"
+
+img = "/zh/post/duomibabi/title/title.png"
+
+times = "18:30"
+
++++
+
+# openGauss1.0.1支持oracle-fdw和mysql-fdw
+
+FDW\(Foreign Data Wrappers\)插件允许在openGauss里访问其他异构数据库的表,openGauss支持Foreign Data Wrappers for oracle (oracle\_fdw),Foreign Data Wrappers for MySQL(mysql\_fdw)和Foreign Data Wrappers for PostgreSQL(Postgres\_fdw),从而支持在openGauss中访问异构其他数据库。
+
+使用postgres\_fdw插件不需要重新编译openGauss,具有系统管理员权限用户直接使用create extension创建扩展组件,普通用户即可create server配置异构数据库连接参数,create user mapping创建异构用户映射关系,CREATE FOREIGN TABLE创建指定数据库的外表。
+
+使用oracle\_fdw和mysql\_fdw插件需要安装相应数据库的客户端包,同时需要重新编译openGauss,在configure时配置enable\_mysql\_fdw和enable\_oracle\_fdw。数据库里创建扩展与上面使用postgres\_fdw类似。
+
+## 数据库客户端包安装
+
+### mysql\(mariadb\)头文件
+
+openGauss源码编译开启enable\_mysql\_fdw需要依赖头文件mariadb\_com.h。
+
+查找资料得知mariadb\_com.h在这个包下:
+
+[mariadb-connector-c-devel-3.0.10-1.el7.x86\_64.rpm](http://repo.okay.com.mx/centos/7/x86_64/release/mariadb-connector-c-devel-3.0.10-1.el7.x86_64.rpm)
+
+```
+# rpm -ql mariadb-connector-c-devel-3.0.10-1.el7 |grep mariadb_com.h
+/usr/include/mysql/mariadb_com.h
+```
+
+Centos7.6下顺藤摸瓜按依赖安装。
+
+```
+# rpm -ivh MariaDB-common-5.5.68-1.el7.centos.x86_64.rpm
+# rpm -ivh crypto-policies-20170816-1.git2618a6c.el7.noarch.rpm
+# rpm -ivh openssl11-libs-1.1.0i-1.el7.x86_64.rpm
+# rpm -ivh mariadb-connector-c-3.0.10-1.el7.x86_64.rpm
+# rpm -ivh mariadb-connector-c-devel-3.0.10-1.el7.x86_64.rpm
+```
+
+### oracle客户端包
+
+```
+# yum install oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
+# yum install oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
+```
+
+安装完上面两个包后,修改下动态库环境变量。
+
+```
+# vi /etc/ld.so.conf
+include ld.so.conf.d/*.conf
+/usr/lib/oracle/11.2/client64/lib
+
+# ldconfig
+```
+
+## openGauss-sever源码编译
+
+### configure配置enable\_mysql\_fdw和enable\_oracle\_fdw
+
+```
+./configure --prefix=/opt/og \
+--gcc-version=8.2.0 \
+--3rd=/opt/binarylibs \
+--with-readline \
+--with-zlib \
+--with-libxml \
+--enable-mysql-fdw \
+--enable-oracle-fdw \
+--enable-thread-safety \
+CC=g++ CFLAGS="-O2 -g3"
+```
+
+### make
+
+```
+make -sj
+make -sj install
+```
+
+### 初始化
+
+```
+/opt/og/bin/gs_initdb --nodename=og_6432 \
+--pgdata=/opt/ogdata \
+--encoding=UTF-8 \
+--locale=en_US.UTF-8 \
+--username=omm \
+--pwpasswd=Enmotech@2020 \
+--security
+
+vi /opt/ogdata/postgresql.conf
+port=6432
+listen_addresses = '0.0.0.0'
+password_encryption_type = 0
+```
+
+### 启动服务
+
+```
+/opt/og/bin/gs_ctl start -D /opt/ogdata -l og_server.log &
+```
+
+### 创建用户
+
+```
+create user postgres sysadmin IDENTIFIED BY 'Enmotech@2020';
+create user opengauss IDENTIFIED BY 'Enmotech@2020';
+```
+
+postgres用户具有管理权限,而已用来创建extension及分配普通用户使用fdw的权限openGauss普通用户可以创建server及使用外部表。
+
+## FDW测试
+
+### mysql\_fdw测试
+
+创建扩展\(用户必须有sysadmin权限\)。
+
+```
+$ gsql -p6432 -Upostgres postgres
+
+postgres=> create extension mysql_fdw with schema public;
+CREATE EXTENSION
+```
+
+查看扩展版本。
+
+```
+postgres=> select mysql_fdw_version();
+ mysql_fdw_version
+-------------------
+ 20503
+(1 row)
+```
+
+postgres用户\(有sysadmin管理权限\)赋予普通用户openGauss使用mysql\_fdw权限。
+
+```
+postgres=> grant USAGE on FOREIGN data wrapper mysql_fdw to opengauss;
+GRANT
+```
+
+普通用户openGauss操作创建server。
+
+```
+postgres=> create server server_mysql foreign data wrapper mysql_fdw options(host'172.19.0.100',port '3306');
+CREATE SERVER
+```
+
+普通用户openGauss操作创建用户映射。
+
+```
+postgres=> create user mapping for opengauss server server_mysql options(username 'root',password '123456');
+CREATE USER MAPPING
+```
+
+普通用户openGauss创建外部表。
+
+```
+postgres=> create foreign table f_mysql_t1(
+id int
+)server server_mysql
+options (dbname 'mysql',table_name 't1');
+CREATE FOREIGN TABLE
+```
+
+通过外部表查询mysql数据库表数据。
+
+```
+postgres=> select * from f_mysql_t1;
+ id
+------
+ 1001
+(1 row)
+```
+
+从openGauss端写入数据到mysql。
+
+```
+postgres=> insert into f_mysql_t1 values(1002);
+INSERT 0 1
+```
+
+注意mysql端表必须有主键或唯一索引,否则会报错。
+
+```
+postgres=> insert into f_mysql_t1 values(1002);
+ERROR: first column of remote table must be unique for INSERT/UPDATE/DELETE operation
+```
+
+再次查看数据。
+
+```
+postgres=> select * from f_mysql_t1;
+ id
+------
+ 1001
+ 1002
+(2 rows)
+```
+
+### oracle\_fdw测试
+
+与mysql\_fdw类似,注意LD\_LIBRARY\_PATH配置了oracle的lib路径(/usr/lib/oracle/11.2/client64/lib)创建扩展\(用户必须有sysadmin权限\)。
+
+```
+$ gsql -p6432 -Upostgres postgres
+
+postgres=# create extension oracle_fdw with schema public;
+CREATE EXTENSION
+```
+
+查看扩展版本。
+
+```
+postgres=> select oracle_diag();
+ oracle_diag
+--------------------------------------------------------------
+ oracle_fdw 2.2.0, PostgreSQL 9.2.4, Oracle client 11.2.0.4.0
+(1 row)
+```
+
+postgres用户\(有sysadmin管理权限\)赋予普通用户opengauss使用oracle\_fdw权限。
+
+```
+postgres=> grant USAGE on FOREIGN data wrapper oracle_fdw to opengauss;
+GRANT
+```
+
+普通用户openGauss操作创建server。
+
+```
+$ gsql -p6432 -Uopengauss postgres
+
+postgres=> create server server_oracle foreign data wrapper oracle_fdw options(dbserver '172.17.0.2:1521/lee');
+CREATE SERVER
+```
+
+普通用户openGauss操作创建用户映射。
+
+```
+postgres=> create user mapping for opengauss server server_oracle options(user 'system',password 'admin');
+CREATE USER MAPPING
+```
+
+普通用户openGauss创建外部表。
+
+```
+postgres=> create foreign table f_oracle_t2(
+id int
+)server server_oracle
+OPTIONS (
+ schema 'SYSTEM',
+ "table" 'T2'
+);
+CREATE FOREIGN TABLE
+```
+
+通过外部表查询oracle数据库t2表数据。
+
+```
+postgres=> select * from f_oracle_t2;
+ id
+------
+ 2001
+(1 row)
+```
+
+从openGauss端写入数据到oracle数据库t2表。
+
+```
+postgres=> insert into f_oracle_t2 values(2002);
+INSERT 0 1
+```
+
+再次查看数据。
+
+```
+postgres=> select * from f_oracle_t2 ;
+ id
+------
+ 2001
+ 2002
+(2 rows)
+```
diff --git a/content/zh/post/duomibabi/title/title.png b/content/zh/post/duomibabi/title/title.png
new file mode 100644
index 0000000000000000000000000000000000000000..c8e78dc25b21514bf820a69a765f0b9ec0df4f07
Binary files /dev/null and b/content/zh/post/duomibabi/title/title.png differ