原 在Docker环境中快速体验YMatrix数据库
Tags: 原创Docker快速体验MPP容器国产YMatrix
环境准备
1 2 3 4 5 6 7 8 | docker rm -f lhrmatrixdb docker run -itd --name lhrmatrixdb -h lhrmatrixdb \ -p 5432:5432 -p 8240:8240 -p 8086:8086 -p 33389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/matrixdb:5.0 \ /usr/sbin/init |
启动
1 2 3 4 | docker exec -it lhrmatrixdb bash su - mxadmin mxstart -a |
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | [root@lhrdb ~]# docker run -itd --name lhrmatrixdb -h lhrmatrixdb \ > -p 5432:5432 -p 8240:8240 -p 8086:8086 -p 33389:3389 \ > -v /sys/fs/cgroup:/sys/fs/cgroup \ > --privileged=true lhrbest/matrixdb:5.0 \ > /usr/sbin/init 8787d19fc67bd564929b48f09899fc7ef799ebd89db537d1030e388716854ca3 [root@lhrdb ~]# [root@lhrdb ~]# docker exec -it lhrmatrixdb bash [root@lhrmatrixdb /]# su - mxadmin Last login: Thu Apr 6 15:57:41 CST 2023 ********** MatrixDB Administrator ********** The MatrixDB on 5432 is not running Start the database with mxstart -a ******************************************** [mxadmin@lhrmatrixdb ~]$ mxstart -a 2023-04-06:16:08:12.735 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Starting MatrixDB cluster with: [no-prompt:true]. 2023-04-06:16:08:12.735 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Connecting to physical cluster's etcd cluster ... 2023-04-06:16:08:12.747 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Connected to physical cluster's etcd cluster: [http://172.71.0.2:4679]. 2023-04-06:16:08:12.747 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Collecting database cluster ID ... 2023-04-06:16:08:12.747 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Collected database cluster ID: K5wAqr8EDiRFPT8Dhbi9ew 2023-04-06:16:08:12.754 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Collecting cluster info ... 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:---------------------------- 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Master instance parameters 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:---------------------------- 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Master Host = lhrmatrixdb 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Master Port = 5432 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Master Directory = /mxdata_20230406130924/master/mxseg-1 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:---------------------------------------- 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Segment instances that will be started 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:---------------------------------------- 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Host Port DataDir Role 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-lhrmatrixdb 6000 /mxdata_20230406130924/primary/mxseg0 PRIMARY 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-lhrmatrixdb 6001 /mxdata_20230406130924/primary/mxseg1 PRIMARY 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-lhrmatrixdb 6002 /mxdata_20230406130924/primary/mxseg2 PRIMARY 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-lhrmatrixdb 6003 /mxdata_20230406130924/primary/mxseg3 PRIMARY 2023-04-06:16:08:12.756 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Commencing parallel primary and mirror segment instance startup, please wait ... 2023-04-06:16:08:12.763 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Send start to cluster service 2023-04-06:16:08:16.319 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-DB instances process started. Waiting for status in-sync ... 2023-04-06:16:08:17.328 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Database instance started and status is in sync. 2023-04-06:16:08:17.346 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Send reload request to cluster service 2023-04-06:16:08:18.410 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-Cluster GUC reloaded. 2023-04-06:16:08:18.416 mxstart:mxadmin:lhrmatrixdb:000505-[INFO]:-MatrixDB cluster successfully started. [mxadmin@lhrmatrixdb ~]$ [mxadmin@lhrmatrixdb ~]$ psql -d postgres psql (12) Type "help" for help. postgres=# |
远程访问
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | [root@lhrdb ~]# psql -U mxadmin -h 192.18.0.14 -p5432 -d postgres Password for user mxadmin: psql (14.7, server 12) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+---------+----------+------------+------------+--------------------- matrixmgr | mxadmin | UTF8 | en_US.utf8 | en_US.utf8 | postgres | mxadmin | UTF8 | en_US.utf8 | en_US.utf8 | template0 | mxadmin | UTF8 | en_US.utf8 | en_US.utf8 | =c/mxadmin + | | | | | mxadmin=CTc/mxadmin template1 | mxadmin | UTF8 | en_US.utf8 | en_US.utf8 | =c/mxadmin + | | | | | mxadmin=CTc/mxadmin (4 rows) postgres=# select version(); version --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 12 (MatrixDB 5.0.0+community) (Greenplum Database 7.0.0+dev.20476.g346be35d90 build commit:346be35d90d3b69877dc6262b163f68bd08b902c) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9), 64-bit compiled on Mar 31 2023 08:22:55 (1 row) postgres=# postgres=# select * from gp_segment_configuration ; dbid | content | role | preferred_role | mode | status | port | hostname | address | datadir ------+---------+------+----------------+------+--------+------+-------------+-------------+--------------------------------------- 1 | -1 | p | p | n | u | 5432 | lhrmatrixdb | lhrmatrixdb | /mxdata_20230406130924/master/mxseg-1 2 | 0 | p | p | n | u | 6000 | lhrmatrixdb | lhrmatrixdb | /mxdata_20230406130924/primary/mxseg0 5 | 3 | p | p | n | u | 6003 | lhrmatrixdb | lhrmatrixdb | /mxdata_20230406130924/primary/mxseg3 3 | 1 | p | p | n | u | 6001 | lhrmatrixdb | lhrmatrixdb | /mxdata_20230406130924/primary/mxseg1 4 | 2 | p | p | n | u | 6002 | lhrmatrixdb | lhrmatrixdb | /mxdata_20230406130924/primary/mxseg2 (5 rows) postgres=# |
web界面管理
http://192.18.0.14:8240 密码:lhr