<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
openGauss是一款支援SQL2003標準語法,支援主備部署的高可用關係型資料庫。
x86-64 CentOS 7.6
ARM64 openEuler 20.03 LTS
[root@node ~]# cat /etc/centos-release CentOS Linux release 7.6.1810 (Core)
[root@node ~]# cat /etc/centos-release CentOS Linux release 7.6.1810 (Core) [root@node ~]# systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2022-10-04 16:38:46 CST; 6min ago Docs: https://docs.docker.com Main PID: 10737 (dockerd) Tasks: 175 Memory: 288.8M CGroup: /system.slice/docker.service ├─10737 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock ├─21641 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9000 -container-ip 172.17.0.2 -container-port 9000 ├─21647 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 9000 -container-ip 172.17.0.2 -container-port 9000 ├─21712 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6888 -container-ip 172.28.0.2 -container-port 6888 ├─21718 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6888 -container-ip 172.28.0.2 -container-port 6888 ├─21727 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3396 -container-ip 172.27.0.2 -container-port 3306 ├─21733 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3396 -container-ip 172.27.0.2 -container-port 3306 ├─21747 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8012 -container-ip 172.17.0.3 -container-port 80 ├─21753 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8012 -container-ip 172.17.0.3 -container-port 80 ├─21781 /usr/bin/docker-proxy -proto udp -host-ip 0.0.0.0 -host-port 6888 -container-ip 172.28.0.2 -container-port 6888 ├─21787 /usr/bin/docker-proxy -proto udp -host-ip :: -host-port 6888 -container-ip 172.28.0.2 -container-port 6888 ├─21794 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8129 -container-ip 172.27.0.3 -container-port 80 ├─21799 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8129 -container-ip 172.27.0.3 -container-port 80 ├─21848 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6800 -container-ip 172.28.0.2 -container-port 6800 ├─21868 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9080 -container-ip 172.17.0.4 -container-port 80 ├─21874 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6800 -container-ip 172.28.0.2 -container-port 6800 ├─21881 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 9080 -container-ip 172.17.0.4 -container-port 80 ├─21885 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3306 -container-ip 192.168.224.3 -container-port 3306 ├─21897 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3306 -container-ip 192.168.224.3 -container-port 3306 ├─21910 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3544 -container-ip 172.17.0.5 -container-port 3306 ├─21920 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3544 -container-ip 172.17.0.5 -container-port 3306 ├─21945 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8712 -container-ip 172.17.0.6 -container-port 80 ├─21951 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8712 -container-ip 172.17.0.6 -container-port 80 ├─23999 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8987 -container-ip 192.168.224.2 -container-port 8181 └─24005 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8987 -container-ip 192.168.224.2 -container-port 8181 Oct 04 16:38:53 node dockerd[10737]: time="2022-10-04T16:38:53.566667153+08:00" level=info msg="ignoring event" container=b2b3518e620d51474c9679c...askDelete" Oct 04 16:38:54 node dockerd[10737]: time="2022-10-04T16:38:54+08:00" level=info msg="Firewalld: docker zone already exists, returning" Oct 04 16:38:54 node dockerd[10737]: time="2022-10-04T16:38:54.414988302+08:00" level=info msg="ignoring event" container=b2b3518e620d51474c9679c...askDelete" Oct 04 16:38:55 node dockerd[10737]: time="2022-10-04T16:38:55+08:00" level=info msg="Firewalld: docker zone already exists, returning" Oct 04 16:38:55 node dockerd[10737]: time="2022-10-04T16:38:55.726427597+08:00" level=info msg="ignoring event" container=b2b3518e620d51474c9679c...askDelete" Oct 04 16:38:56 node dockerd[10737]: time="2022-10-04T16:38:56+08:00" level=info msg="Firewalld: docker zone already exists, returning" Oct 04 16:38:57 node dockerd[10737]: time="2022-10-04T16:38:57.225224508+08:00" level=info msg="ignoring event" container=b2b3518e620d51474c9679c...askDelete" Oct 04 16:38:58 node dockerd[10737]: time="2022-10-04T16:38:58+08:00" level=info msg="Firewalld: docker zone already exists, returning" Oct 04 16:38:58 node dockerd[10737]: time="2022-10-04T16:38:58.973644718+08:00" level=info msg="ignoring event" container=b2b3518e620d51474c9679c...askDelete" Oct 04 16:39:01 node dockerd[10737]: time="2022-10-04T16:39:01+08:00" level=info msg="Firewalld: docker zone already exists, returning" Hint: Some lines were ellipsized, use -l to show in full.
1.從3.0版本開始(包括3.0版本)
2.容器採用openGauss資料庫Lite版本
3.預設啟動後空載記憶體小於200M
4.新增vi,ps,等基礎命令
[root@node openguass]# docker pull enmotech/opengauss:3.0.0 3.0.0: Pulling from enmotech/opengauss 22c5ef60a68e: Pull complete 28692a7bf40a: Pull complete 53d8b65999fe: Pull complete 2feb7fb751a7: Pull complete 21970696c490: Pull complete Digest: sha256:b8a21dfa15d57476528051f1b8b138dac45cfbad3ef97cba2b340433476147f8 Status: Downloaded newer image for enmotech/opengauss:3.0.0 docker.io/enmotech/opengauss:3.0.0
mkdir -p /data/openguass/
docker run --name opengauss -d --restart always --privileged=true -e GS_PASSWORD=Admin@123456 -v /data/opengauss/mysql:/var/lib/opengauss -u root -p 15432:5432 enmotech/opengauss:3.0.0
GS_PASSWORD:設定openGauss資料庫的超級使用者omm以及測試使用者gaussdb的密碼
GS_NODENAME:資料庫節點名稱,預設為gaussdb。
GS_USERNAME:資料庫連線使用者名稱,預設為gaussdb。
GS_PORT:資料庫埠,預設為5432。
[root@node openguass]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b5abda90d924 enmotech/opengauss:3.0.0 "entrypoint.sh gauss…" 25 seconds ago Up 24 seconds 0.0.0.0:15432->5432/tcp, :::15432->5432/tcp
[root@node openguass]# docker exec -it 360296c286c9 /bin/bash root@360296c286c9:/# su - omm omm@360296c286c9:~$ gsql gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. omm=#
[admin@master ~]$ gsql -d postgres -U gaussdb -W'Admin@123456' -h 192.168.3.167 -p15432 gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. openGauss=>
wget https://raw.githubusercontent.com/enmotech/enmotech-docker-opengauss/master/create_master_slave.sh
OG_SUBNET (容器所在網段) [172.11.0.0/24] GS_PASSWORD (定義資料庫密碼)[Enmo@123] MASTER_IP (主庫IP)[172.11.0.101] SLAVE_1_IP (備庫IP)[172.11.0.102] MASTER_HOST_PORT (主庫資料庫伺服器埠)[5432] MASTER_LOCAL_PORT (主庫通訊埠)[5434] SLAVE_1_HOST_PORT (備庫資料庫伺服器埠)[6432] SLAVE_1_LOCAL_PORT (備庫通訊埠)[6434] MASTER_NODENAME (主節點名稱)[opengauss_master] SLAVE_NODENAME (備節點名稱)[opengauss_slave1]
[root@node openguass]# cat create_master_slave.sh #!/bin/bash -e # Parameters #!/bin/bash #set OG_SUBNET,GS_PASSWORD,MASTER_IP,SLAVE_1_IP,MASTER_HOST_PORT,MASTER_LOCAL_PORT,SLAVE_1_HOST_PORT,SLAVE_1_LOCAL_PORT,MASTER_NODENAME,SLAVE_NODENAME read -p "Please input OG_SUBNET (容器所在網段) [172.11.0.0/24]: " OG_SUBNET OG_SUBNET=${OG_SUBNET:-172.11.0.0/24} echo "OG_SUBNET set $OG_SUBNET" read -p "Please input GS_PASSWORD (定義資料庫密碼)[Enmo@123]: " GS_PASSWORD GS_PASSWORD=${GS_PASSWORD:-Enmo@123} echo "GS_PASSWORD set $GS_PASSWORD" read -p "Please input MASTER_IP (主庫IP)[172.11.0.101]: " MASTER_IP MASTER_IP=${MASTER_IP:-172.11.0.101} echo "MASTER_IP set $MASTER_IP" read -p "Please input SLAVE_1_IP (備庫IP)[172.11.0.102]: " SLAVE_1_IP SLAVE_1_IP=${SLAVE_1_IP:-172.11.0.102} echo "SLAVE_1_IP set $SLAVE_1_IP" read -p "Please input MASTER_HOST_PORT (主庫資料庫伺服器埠)[5432]: " MASTER_HOST_PORT MASTER_HOST_PORT=${MASTER_HOST_PORT:-5432} echo "MASTER_HOST_PORT set $MASTER_HOST_PORT" read -p "Please input MASTER_LOCAL_PORT (主庫通訊埠)[5434]: " MASTER_LOCAL_PORT MASTER_LOCAL_PORT=${MASTER_LOCAL_PORT:-5434} echo "MASTER_LOCAL_PORT set $MASTER_LOCAL_PORT" read -p "Please input SLAVE_1_HOST_PORT (備庫資料庫伺服器埠)[6432]: " SLAVE_1_HOST_PORT SLAVE_1_HOST_PORT=${SLAVE_1_HOST_PORT:-6432} echo "SLAVE_1_HOST_PORT set $SLAVE_1_HOST_PORT" read -p "Please input SLAVE_1_LOCAL_PORT (備庫通訊埠)[6434]: " SLAVE_1_LOCAL_PORT SLAVE_1_LOCAL_PORT=${SLAVE_1_LOCAL_PORT:-6434} echo "SLAVE_1_LOCAL_PORT set $SLAVE_1_LOCAL_PORT" read -p "Please input MASTER_NODENAME [opengauss_master]: " MASTER_NODENAME MASTER_NODENAME=${MASTER_NODENAME:-opengauss_master} echo "MASTER_NODENAME set $MASTER_NODENAME" read -p "Please input SLAVE_NODENAME [opengauss_slave1]: " SLAVE_NODENAME SLAVE_NODENAME=${SLAVE_NODENAME:-opengauss_slave1} echo "SLAVE_NODENAME set $SLAVE_NODENAME" read -p "Please input openGauss VERSION [3.0.0]: " VERSION VERSION=${VERSION:-3.0.0} echo "openGauss VERSION set $VERSION" echo "starting " docker network create --subnet=$OG_SUBNET opengaussnetwork || { echo "" echo "ERROR: OpenGauss Database Network was NOT successfully created." echo "HINT: opengaussnetwork Maybe Already Exsist Please Execute 'docker network rm opengaussnetwork' " exit 1 } echo "OpenGauss Database Network Created." docker run --network opengaussnetwork --ip $MASTER_IP --privileged=true --name $MASTER_NODENAME -h $MASTER_NODENAME -p $MASTER_HOST_PORT:$MASTER_HOST_PORT -d -e GS_PORT=$MASTER_HOST_PORT -e OG_SUBNET=$OG_SUBNET -e GS_PASSWORD=$GS_PASSWORD -e NODE_NAME=$MASTER_NODENAME -e REPL_CONN_INFO="replconninfo1 = 'localhost=$MASTER_IP localport=$MASTER_LOCAL_PORT localservice=$MASTER_HOST_PORT remotehost=$SLAVE_1_IP remoteport=$SLAVE_1_LOCAL_PORT remoteservice=$SLAVE_1_HOST_PORT'n" enmotech/opengauss:$VERSION -M primary || { echo "" echo "ERROR: OpenGauss Database Master Docker Container was NOT successfully created." exit 1 } echo "OpenGauss Database Master Docker Container created." sleep 30s docker run --network opengaussnetwork --ip $SLAVE_1_IP --privileged=true --name $SLAVE_NODENAME -h $SLAVE_NODENAME -p $SLAVE_1_HOST_PORT:$SLAVE_1_HOST_PORT -d -e GS_PORT=$SLAVE_1_HOST_PORT -e OG_SUBNET=$OG_SUBNET -e GS_PASSWORD=$GS_PASSWORD -e NODE_NAME=$SLAVE_NODENAME -e REPL_CONN_INFO="replconninfo1 = 'localhost=$SLAVE_1_IP localport=$SLAVE_1_LOCAL_PORT localservice=$SLAVE_1_HOST_PORT remotehost=$MASTER_IP remoteport=$MASTER_LOCAL_PORT remoteservice=$MASTER_HOST_PORT'n" enmotech/opengauss:$VERSION -M standby || { echo "" echo "ERROR: OpenGauss Database Slave1 Docker Container was NOT successfully created." exit 1 } echo "OpenGauss Database Slave1 Docker Container created."
[root@node openguass]# sh create_master_slave.sh Please input OG_SUBNET (容器所在網段) [172.11.0.0/24]: OG_SUBNET set 172.11.0.0/24 Please input GS_PASSWORD (定義資料庫密碼)[Enmo@123]: GS_PASSWORD set Enmo@123 Please input MASTER_IP (主庫IP)[172.11.0.101]: MASTER_IP set 172.11.0.101 Please input SLAVE_1_IP (備庫IP)[172.11.0.102]: SLAVE_1_IP set 172.11.0.102 Please input MASTER_HOST_PORT (主庫資料庫伺服器埠)[5432]: MASTER_HOST_PORT set 5432 Please input MASTER_LOCAL_PORT (主庫通訊埠)[5434]: MASTER_LOCAL_PORT set 5434 Please input SLAVE_1_HOST_PORT (備庫資料庫伺服器埠)[6432]: SLAVE_1_HOST_PORT set 6432 Please input SLAVE_1_LOCAL_PORT (備庫通訊埠)[6434]: SLAVE_1_LOCAL_PORT set 6434 Please input MASTER_NODENAME [opengauss_master]: MASTER_NODENAME set opengauss_master Please input SLAVE_NODENAME [opengauss_slave1]: SLAVE_NODENAME set opengauss_slave1 Please input openGauss VERSION [3.0.0]: openGauss VERSION set 3.0.0 starting 97d6c3667b72511c0f09eea31b54b6c5d315af06252db1a7961b0861069f2b5a OpenGauss Database Network Created. 24c3c7ba6b162fabbe9ac4e21f4b188ebd49acbbba91e7458d287ad6731ce48f OpenGauss Database Master Docker Container created. 0376996ac00d91173e24ebea274d0750be9093269dcfdf479722c68952aa93a1 OpenGauss Database Slave1 Docker Container created.
[root@node openguass]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0376996ac00d enmotech/opengauss:3.0.0 "entrypoint.sh -M st…" About a minute ago Up About a minute 5432/tcp, 0.0.0.0:6432->6432/tcp, :::6432->6432/tcp opengauss_slave1 24c3c7ba6b16 enmotech/opengauss:3.0.0 "entrypoint.sh -M pr…" 2 minutes ago Up 2 minutes 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp opengauss_master
[root@node openguass]# docker exec -it 24c3c7ba6b16 /bin/bash root@opengauss_master:/# su - omm omm@opengauss_master:~$ gs_ctl query -D /var/lib/opengauss/data/ [2022-10-04 10:13:45.084][346][][gs_ctl]: gs_ctl query ,datadir is /var/lib/opengauss/data HA state: local_role : Primary static_connections : 1 db_state : Normal detail_information : Normal Senders info: sender_pid : 319 local_role : Primary peer_role : Standby peer_state : Normal state : Streaming sender_sent_location : 0/40002E8 sender_write_location : 0/40002E8 sender_flush_location : 0/40002E8 sender_replay_location : 0/40002E8 receiver_received_location : 0/40002E8 receiver_write_location : 0/40002E8 receiver_flush_location : 0/40002E8 receiver_replay_location : 0/40002E8 sync_percent : 100% sync_state : Sync sync_priority : 1 sync_most_available : On channel : 172.11.0.101:5434-->172.11.0.102:35454 Receiver info: No information
到此這篇關於使用Docker部署openGauss國產資料庫的文章就介紹到這了,更多相關Docker部署openGauss資料庫內容請搜尋it145.com以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援it145.com!
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45