Postgres-XL集群部署与管理

​Postgres-XL:基于PostgreSQL的开源可扩展数据库集群 ​Postgres-XL:基于PostgreSQL的开源可扩展数据库集群                   最近这一年业界去“IOE”越叫越响,很多传统企业也把去“IOE”计划摆上了桌面。我老是想不明白这些非互联网企业(比如:银行)做这种事的动力何在? 高大上的“自主可控”、“振兴民族科技”等空洞口号先不去管,真正的动力在哪里? “安全”、“成本”、“互联网架构”.. 阅读详情

1. https://www.jianshu.com/p/82aaf352b772

2.

from http://blog.51cto.com/hsbxxl/1980423

Postgres-XL 集群详细创建步骤

  1. 主机列表和集群安装的角色分配

1 

2

3

10.21.13.109  GTM

10.21.13.67  coordinator&datanode

10.21.13.60  datanode

2.创建postgres用户,这部分我使用ansible完成的用户创建,以及相关软件包的应用,节省劳动力(yum其实可以使用ansible自带的方式,所以我ansible写的比较业余)

1

2

3

ansible all -m shell -a  "useradd postgres"

ansible all -m shell -a 'echo "postgres:postgres" | chpasswd'

ansible all -m shell -a "yum install -y flex bison readline-devel zlib-devel openjade docbook-style-dsssl gcc"

3. 在每个节点上下载软件,并解压缩

1

2

3

ansible all -m shell -a "wget https://www.postgres-xl.org/downloads/postgres-xl-9.5r1.6.tar.bz2"

ansible all -m shell -a "mv /root/postgres-xl-9.5r1.6.tar.bz2 /tmp; chown postgres:postgres /tmp/postgres-xl-9.5r1.6.tar.bz2"

ansible all -m shell -a "tar  -jxvf /tmp/postgres-xl-9.5r1.6.tar.bz2 -C /home/postgres"

4. 全部节点都创建pgxc路径,用来存放postgres文件

1

ansible all -m shell -a "su - postgres -c 'mkdir -p /home/postgres/pgxc/nodes/'"

5. 修改每个节点的.bashrc文件,注意:修改/etc/profile是不生效的。

1

2

su - postgres

vi .bashrc

添加如下内容:

1

2

3

4

export PGHOME=/home/postgres/pgxl

export PGUSER=postgres

export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH

export PATH=$PGHOME/bin:$PATH

使之生效:

1

source ~/.bashrc

6. 关闭防火墙或者放开相应的端口,这里我直接关闭了每个虚拟机的防火墙,并且重启它们:

1

2

service iptables stop

chkconfig iptables off   --重启后生效

7. 关闭SELinux:

查看SELinux状态:

1

2

/usr/sbin/sestatus -v    ##如果SELinux status参数为enabled即为开启状态

SELinux status:                 enabled

临时关闭(不用重启机器):

1

2

setenforce 0       ##设置SELinux 成为permissive模式

##setenforce 1 设置SELinux 成为enforcing模式

永久关闭:

1

2

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

8. 到每一个节点执行下面的软件安装步骤,这个过程注意,如果中间有报错,需要解决到。例如确实gcc包之类的,不然后面的编译也不会成功的。

1

2

3

4

5

6

7

cd postgres-xl

./configure --prefix=/home/postgres/pgxl/

make

make install

cd contrib/

make

make instal

9. 执行pgxc_ctl命令来生成配置集群的模板文件:

./pgxc_ctl              ---会提示Error说没有配置文件,忽略即可

PGXC prepare            ---执行该命令将会生成一份配置文件模板

10. 根据模板修改对应的主机名,端口等信息,内容如下:

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

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

vi ~/pgxc_ctl/pgxc_ctl.conf

pgxcInstallDir=$HOME/pgxc

pgxcOwner=$USER

pgxcUser=$pgxcOwner

tmpDir=/tmp

localTmpDir=$tmpDir

configBackup=n

configBackupHost=pgxc-linker

configBackupDir=$HOME/pgxc

configBackupFile=pgxc_ctl.bak

gtmName=gtm

gtmMasterServer=10.21.13.109

gtmMasterPort=20001

gtmMasterDir=$HOME/pgxc/nodes/gtm

gtmExtraConfig=none

gtmMasterSpecificExtraConfig=none

gtmSlave=n

gtmProxyDir=$HOME/pgxc/nodes/gtm_pxy

gtmProxy=y

gtmProxyNames=(gtm_pxy1 gtm_pxy2)

gtmProxyServers=(10.21.13.67 10.21.13.60)

gtmProxyPorts=(20001 20001)

gtmProxyDirs=($gtmProxyDir $gtmProxyDir)

gtmPxyExtraConfig=none

gtmPxySpecificExtraConfig=(none none)

coordMasterDir=$HOME/pgxc/nodes/coord

coordSlaveDir=$HOME/pgxc/nodes/coord_slave

coordArchLogDir=$HOME/pgxc/nodes/coord_archlog

coordNames=(coord1)

coordPorts=(20004)

poolerPorts=(20010)

coordPgHbaEntries=(10.21.13.0/25)   <<<<<<<<<<<<<<<<<<<<<<<<<非常重要

coordMasterServers=(10.21.13.67)

coordMasterDirs=($coordMasterDir)

coordMaxWALsernder=5

coordMaxWALSenders=($coordMaxWALsernder)

coordSlave=n               <<<<<<<<<<<<<<<<没使用slave

coordSlaveSync=y

coordSlaveServers=(10.21.13.60 10.21.13.67)

coordSlavePorts=(20004 20005 20004 20005)

coordSlavePoolerPorts=(20010 20011 20010 20011)

coordSlaveDirs=($coordSlaveDir $coordSlaveDir)

coordArchLogDirs=($coordArchLogDir $coordArchLogDir)

coordExtraConfig=coordExtraConfig

cat > $coordExtraConfig <<EOF

log_destination = 'stderr'

logging_collector = on

log_directory = 'pg_log'

listen_addresses = '*'

max_connections = 100

EOF

coordSpecificExtraConfig=(none none)

coordExtraPgHba=none

coordSpecificExtraPgHba=(none none)

coordAdditionalSlaves=n

coordAdditionalSlaveSet=(cad1)

cad1_Sync=n

cad1_Servers=(10.21.13.67 10.21.13.60)

cad1_dir=$HOME/pgxc/nodes/coord_slave_cad1

cad1_Dirs=($cad1_dir $cad1_dir)

cad1_ArchLogDir=$HOME/pgxc/nodes/coord_archlog_cad1

cad1_ArchLogDirs=($cad1_ArchLogDir $cad1_ArchLogDir)

datanodeMasterDir=$HOME/pgxc/nodes/dn_master

datanodeSlaveDir=$HOME/pgxc/nodes/dn_slave

datanodeArchLogDir=$HOME/pgxc/nodes/datanode_archlog

primaryDatanode=datanode1

datanodeNames=(datanode1 datanode2)

datanodePorts=(20008 20008) # Master ports

datanodePoolerPorts=(20012 20012)

datanodePgHbaEntries=(10.21.13.0/25)  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<非常重要

datanodeMasterServers=(10.21.13.67 10.21.13.60)

datanodeMasterDirs=($datanodeMasterDir $datanodeMasterDir)

datanodeMaxWalSender=5

datanodeMaxWALSenders=($datanodeMaxWalSender $datanodeMaxWalSender )

datanodeSlave=n                <<<<<<<<<<<<<<<<没使用slave

datanodeSlaveServers=(10.21.13.60 10.21.13.67)

datanodeSlavePorts=(20008 20008)

datanodeSlavePoolerPorts=(20012 20012)

datanodeSlaveSync=y

datanodeSlaveDirs=($datanodeSlaveDir $datanodeSlaveDir)

datanodeArchLogDirs=( $datanodeArchLogDir $datanodeArchLogDir )

datanodeExtraConfig=none

datanodeSpecificExtraConfig=(none none )

datanodeExtraPgHba=none

datanodeSpecificExtraPgHba=(none none)

datanodeAdditionalSlaves=n

walArchive=n       <<<<<<<<<<<<<<<<不开wal归档

walArchiveSet=(war1 war2)

war1_source=(master)

wal1_source=(slave)

wal1_source=(additiona_coordinator_slave_set additional_datanode_slave_set)

war1_host=node10

war1_backupdir=$HOME/pgxc/backup_war1

wal2_source=(master)

war2_host=node11

war2_backupdir=$HOME/pgxc/backup_war2

11. 初始话命令,如果前面没有任何错误,这里就是最后一步了,PGXL会把全部的部署工作完成的。

pgxc_ctl -c pgxc_ctl.conf init all

完整输出如下:

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

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

[postgres@ip-10-21-13-109 pgxc_ctl]$ pgxc_ctl -c pgxc_ctl.conf init all 

/bin/bash

Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.

Installing pgxc_ctl_bash script as /home/postgres/pgxc_ctl/pgxc_ctl_bash.

Reading configuration using /home/postgres/pgxc_ctl/pgxc_ctl_bash --home /home/postgres/pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf

Finished reading configuration.

   ******** PGXC_CTL START ***************

Current directory: /home/postgres/pgxc_ctl

Initialize GTM master

ERROR: target directory (/home/postgres/pgxc/nodes/gtm) exists and not empty. Skip GTM initilialization

1:3768231680:2017-11-09 19:35:02.983 CST -FATAL:  lock file "gtm.pid" already exists

2:3768231680:2017-11-09 19:35:02.983 CST -HINT:  Is another GTM (PID 14635) running in data directory "/home/postgres/pgxc/nodes/gtm"?

LOCATION:  CreateLockFile, main.c:2099

waiting for server to shut down... done

server stopped

Done.

Start GTM master

server starting

Initialize all the gtm proxies.

Initializing gtm proxy gtm_pxy1.

Initializing gtm proxy gtm_pxy2.

waiting for server to shut down... done

server stopped

The files belonging to this GTM system will be owned by user "postgres".

This user must also own the server process.

fixing permissions on existing directory /home/postgres/pgxc/nodes/gtm_pxy ... ok

creating configuration files ... ok

Success.

waiting for server to shut down... done

server stopped

The files belonging to this GTM system will be owned by user "postgres".

This user must also own the server process.

fixing permissions on existing directory /home/postgres/pgxc/nodes/gtm_pxy ... ok

creating configuration files ... ok

Success.

Done.

Starting all the gtm proxies.

Starting gtm proxy gtm_pxy1.

Starting gtm proxy gtm_pxy2.

server starting

server starting

Done.

Initialize all the coordinator masters.

Initialize coordinator master coord1.

ERROR: target coordinator master coord1 is running now.   Skip initilialization.

Done.

Starting coordinator master.

Starting coordinator master coord1

ERROR: target coordinator master coord1 is already running now.   Skip initialization.

Done.

Initialize all the datanode masters.

Initialize the datanode master datanode1.

Initialize the datanode master datanode2.

The files belonging to this database system will be owned by user "postgres".

This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".

The default database encoding has accordingly been set to "UTF8".

The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/postgres/pgxc/nodes/dn_master ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 128MB

selecting dynamic shared memory implementation ... posix

creating configuration files ... ok

creating template1 database in /home/postgres/pgxc/nodes/dn_master/base/1 ... ok

initializing pg_authid ... ok

initializing dependencies ... ok

creating system views ... ok

creating cluster information ... ok

loading system objects' descriptions ... ok

creating collations ... ok

creating conversions ... ok

creating dictionaries ... ok

setting privileges on built-in objects ... ok

creating information schema ... ok

loading PL/pgSQL server-side language ... ok

vacuuming database template1 ... ok

copying template1 to template0 ... ok

copying template1 to postgres ... ok

syncing data to disk ... ok

freezing database template0 ... ok

freezing database template1 ... ok

freezing database postgres ... ok

WARNING: enabling "trust" authentication for local connections

You can change this by editing pg_hba.conf or using the option -A, or

--auth-local and --auth-host, the next time you run initdb.

Success.

The files belonging to this database system will be owned by user "postgres".

This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".

The default database encoding has accordingly been set to "UTF8".

The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/postgres/pgxc/nodes/dn_master ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 128MB

selecting dynamic shared memory implementation ... posix

creating configuration files ... ok

creating template1 database in /home/postgres/pgxc/nodes/dn_master/base/1 ... ok

initializing pg_authid ... ok

initializing dependencies ... ok

creating system views ... ok

creating cluster information ... ok

loading system objects' descriptions ... ok

creating collations ... ok

creating conversions ... ok

creating dictionaries ... ok

setting privileges on built-in objects ... ok

creating information schema ... ok

loading PL/pgSQL server-side language ... ok

vacuuming database template1 ... ok

copying template1 to template0 ... ok

copying template1 to postgres ... ok

syncing data to disk ... ok

freezing database template0 ... ok

freezing database template1 ... ok

freezing database postgres ... ok

WARNING: enabling "trust" authentication for local connections

You can change this by editing pg_hba.conf or using the option -A, or

--auth-local and --auth-host, the next time you run initdb.

Success.

Done.

Starting all the datanode masters.

Starting datanode master datanode1.

Starting datanode master datanode2.

LOG:  redirecting log output to logging collector process

HINT:  Future log output will appear in directory "pg_log".

LOG:  redirecting log output to logging collector process

HINT:  Future log output will appear in directory "pg_log".

Done.

ALTER NODE coord1 WITH (HOST='10.21.13.67', PORT=20004);

ALTER NODE

CREATE NODE datanode1 WITH (TYPE='datanode', HOST='10.21.13.67', PORT=20008, PRIMARY, PREFERRED);

ERROR:  PGXC Node datanode1: object already defined

CREATE NODE datanode2 WITH (TYPE='datanode', HOST='10.21.13.60', PORT=20008);

ERROR:  PGXC Node datanode2: object already defined

SELECT pgxc_pool_reload();

 pgxc_pool_reload 

------------------

 t

(1 row)

Done.

EXECUTE DIRECT ON (datanode1) 'CREATE NODE coord1 WITH (TYPE=''coordinator'', HOST=''10.21.13.67'', PORT=20004)';

EXECUTE DIRECT

EXECUTE DIRECT ON (datanode1) 'ALTER NODE datanode1 WITH (TYPE=''datanode'', HOST=''10.21.13.67'', PORT=20008, PRIMARY, PREFERRED)';

EXECUTE DIRECT

EXECUTE DIRECT ON (datanode1) 'CREATE NODE datanode2 WITH (TYPE=''datanode'', HOST=''10.21.13.60'', PORT=20008)';

EXECUTE DIRECT

EXECUTE DIRECT ON (datanode1) 'SELECT pgxc_pool_reload()';

 pgxc_pool_reload 

------------------

 t

(1 row)

EXECUTE DIRECT ON (datanode2) 'CREATE NODE coord1 WITH (TYPE=''coordinator'', HOST=''10.21.13.67'', PORT=20004)';

EXECUTE DIRECT

EXECUTE DIRECT ON (datanode2) 'CREATE NODE datanode1 WITH (TYPE=''datanode'', HOST=''10.21.13.67'', PORT=20008, PRIMARY, PREFERRED)';

EXECUTE DIRECT

EXECUTE DIRECT ON (datanode2) 'ALTER NODE datanode2 WITH (TYPE=''datanode'', HOST=''10.21.13.60'', PORT=20008)';

EXECUTE DIRECT

EXECUTE DIRECT ON (datanode2) 'SELECT pgxc_pool_reload()';

 pgxc_pool_reload 

------------------

 t

(1 row)

Done.

12. 验证可用性

在coordinator节点上,本地连接方式

1

psql -p 20004

远程用户连接方式

1

psql -h 10.21.13.67 -p 20004 -U postgres

1

2

3

4

5

6

postgres=# select * from pgxc_node;

node_name | node_type | node_port |  node_host  | nodeis_primary | nodeis_preferred |  node_id

-----------+-----------+-----------+-------------+----------------+------------------+------------

datanode1 | D         |     20008 | 10.21.13.67 | t              | t                |  888802358

datanode2 | D         |     20008 | 10.21.13.60 | f              | f                | -905831925

coord1    | C         |     20004 | 10.21.13.67 | f              | f                | 1885696643

13. 建表测试

postgres=#  create table test(id integer,name varchar(10));

postgres=#  insert into test(id,name) values(1,'test');

postgres=#  insert into test(id,name) values(2,'test');

查询结果

1

2

3

4

5

6

postgres=# select * from test;

id | name

----+------

1 | test

2 | test

(2 rows)

问题汇总:

1. 如果登陆到数据库中,执行下面语句,发现只有coord的信息,说明并没有创建成功,

1

2

3

4

5

postgres=# select * from pgxc_node;

node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred |  node_id

-----------+-----------+-----------+-----------+----------------+------------------+------------

coord3    | C         |      20004 | localhost | f              | f          | 1638403545

(1 row)

而问题是出在coordPgHbaEntries=(10.21.13.0/25)和datanodePgHbaEntries=(10.21.13.0/25)的访问权限控制上,一定要和实际的子网掩码匹配,不然各个datanode节点和coord节点间是无法正常通讯的。

由于没有注意各个细节,让这个问题困扰我一周时间。一直在找为什么datanode之间不能相互识别的原因,其实就是很小的一个点。

1

2

3

4

5

6

7

8

9

10

[postgres@ip-10-21-13-109 pgxc_ctl]$ ifconfig

eth0      Link encap:Ethernet  HWaddr 02:57:E7:56:4C:70

inet addr:10.21.13.109  Bcast:10.21.13.127  Mask:255.255.255.128<<<<<<10.21.13.0/25

inet6 addr: fe80::57:e7ff:fe56:4c70/64 Scope:Link

UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1

RX packets:29500 errors:0 dropped:0 overruns:0 frame:0

TX packets:28538 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:3113614 (2.9 MiB)  TX bytes:4653853 (4.4 MiB)

Interrupt:160

2. 如果遇到建表,建库失败,也是遇到上面的访问控制权限问题。在部署完成之后,这个参数是在/home/postgres/pgxc/nodes/dn_master/pg_hba.conf和/home/postgres/pgxc/nodes/coord/pg_hba.conf中设置的。但是重新init,会覆盖掉这些文件的。

1

2

3

4

5

postgres=# create database test;

ERROR:  Failed to get pooled connections

HINT:  This may happen because one or more nodes are currently unreachable, either because of node or network failure.

Its also possible that the target node may have hit the connection limit or the pooler is configured with low connections.

Please check if all nodes are running fine and also review max_connections and max_pool_size configuration parameters

3. 有很多人的安装方式,是最后通过手动执行下面命令,添加coord和datanode,其实前面的pgxc_ctl.conf配置正确的话,脚本都是自动帮你完成的,没有必要人工干预

1

2

3

4

5

6

create node coord1 with (type=coordinator,host='c6702', port=20004);

create node coord2 with (type=coordinator,host='c6703', port=20005);

alter node coord3 with (type=coordinator,host='c6704', port=20004);

create node datanode1 with (type=datanode, host='c6702',port=20008);

create node datanode2 with (type=datanode, host='c6703',port=20008);

alter  node datanode3 with (type=datanode, host='c6704',port=20008);

4. 第8步,make PGXL软件过程中,一定要仔细查看输出,有错误一定要纠正。不然后续会发现,有很多命令软件,都没有安装成功。

5.如果你在远程登陆postgres sql遇到如下问题

1

2

[root@c6703 ~]# psql -h 10.21.13.67 -p 20004 -U postgres

psql: FATAL:  no pg_hba.conf entry for host "172.16.32.116", user "postgres", database "postgres"

修改/home/postgres/pgxc/nodes/dn_master/pg_hba.conf和/home/postgres/pgxc/nodes/coord/pg_hba.conf中的访问控制权允许对应的IP有访问权限,就可以登陆了。注意,要修改全部的coordinator和datanode的pg_hba.conf配置文件才行。然后通过postgres用户执行reload命令,使配置文件生效。或者重启使配置生效。

1

2

3

4

5

6

[root@c6703 ~]# psql -h 10.21.13.67 -p 20004 -U test

postgres=# SELECT pg_reload_conf();

[root@c6703 ~]# psql -h 10.21.13.67 -p 20004 -U test

Password for user test: 

psql (PGXL 9.5r1.6, based on PG 9.5.8 (Postgres-XL 9.5r1.6))

Type "help" for help.

下面三篇是我主要参考的blog,帮助很大,但是每一个都有“坑”。所以,只有自己动手实验过,才会记住,你掉过和跳过的“坑”

http://blog.youkuaiyun.com/yeruby/article/details/48996027

https://www.cnblogs.com/songyuejie/archive/2015/08/23/4752124.html

http://blog.youkuaiyun.com/freeland1/article/details/52346669?ref=myread

附件是第10和11步的文本文件,可以下载修改并使用。

附件:http://down.51cto.com/data/2368732

PostgreSQL-XL安装部署与配置 接下来,创建一个名为 “datanode.ini” 的文件,并按照类似的方式配置它,以适应 Datanode 节点的配置。在 PostgreSQL-XL 的安装目录中,创建一个名为 “coordinator.ini” 的文件,并使用文本编辑器打开它。将 “/path/to/postgres-xl” 和 “/path/to/data_directory” 替换为实际的路径。将"/path/to/postgres-xl"和"/path/to/data_directory"替换为实际的路径。 阅读详情

相关推荐

PostgreSQL:安装和部署Postgres-XL

首先,我们下载并安装了Postgres-XL的安装包。然后,安装了必要的依赖项,并编译和安装了Postgres-XL。接下来,创建了一个Postgres-XL集群并进行了相关的配置。为了管理Postgres-XL集群,Postgres-XL提供了一个名为pgxc_ctl的命令行工具。一旦集群成功启动,我们可以通过连接到任何一个节点来测试Postgres-XL的功能。安装完成后,我们需要创建一个Postgres-XL集群并进行相应的配置。在完成依赖项的安装后,我们可以开始编译和安装Postgres-XL。

XwlyVue的博客 525

Postgres-XL 集群详细创建步骤

最近公司业务需求,需要使用Postgres-XL 集群,关于这部分知识,网络资料不多。经过一段时间的查询,和各种弯路之后,终于完成安装。将详细步骤完整记录,以备查阅。也希望能帮到需要的人。 下面就开始吧: 主机列表和集群安装的角色分配 1 2 3 10.21.13.109GTM 10.21.13.67coordinator&a...

weixin_33701564的博客 380

Postgres-XL集群部署文档2022.docx

Postgres的-XL是一个基于PostgreSQL数据库的横向扩展开源SQL数据库集群,具有足够的灵活性来处理不同的数据库工作负载:完全ACID、保持事务一致性、OLTP 写频繁的业务、需要MPP并行性商业智能/大数据分析。

Postgres-XL 测试benchmarksql报错 Failed to get pooled connections

1个gtm, 4个node, 没有slave, 手动控制台可以执行任何 跑benchmarksql cat prog.pg user=benchmarksql password=abc 建用户, 建数据库 #create user benchmarksql with encrypted password 'abc'; #create database benchmarksql...

ma100的专栏 2401

postgres-xl数据库集群安装部署说明手册

postgres-xl9.5数据库集群安装部署说明手册 包括:安装环境说明、依赖项说明、以及postgres-xl数据库编译说明、节点划分说明、以及手动方式部署启动集群及使用验证;自动方式部署启动集群等。

基于OpenCV的围棋终局识别与胜负判定系统实现

计算机视觉是人工智能领域的关键技术,它使计算机能够从数字图像或视频中获取、处理和分析信息。其核心原理在于通过图像处理算法提取特征,并基于这些特征进行识别、分类和测量。在工程实践中,计算机视觉技术为自动化、智能化应用提供了强大支持,广泛应用于工业检测、自动驾驶、医疗影像分析等领域。本文聚焦于一个具体的应用场景:利用OpenCV库实现围棋终局识别。通过图像预处理、棋盘检测与透视校正、交叉点定位等步骤,结合围棋规则逻辑,构建了一套从棋盘图像自动判定胜负的解决方案。该方案涉及自适应二值化、霍夫变换、连通域分析等关键

weixin_29100927的博客 279

Postgres-XL集群部署与管理指南

Postgres-XL是一个基于PostgreSQL数据库的横向扩展开源SQL数据库集群,具有足够的灵活性来处理不同的数据库工作负载,架构如下图所示: Web 2.0 操作数据存储 GIS的地理空间 混合业务工作环境 OLTP 写频繁的业务 多租户服务提供商托管环境 完全ACID,保持事务一致性 包含JSON的Key-value 存储 需要MPP并行性商业智能/大数据分析各个组件介绍如下: Gl...

weixin_34417183的博客 791

电磁兼容标准体系解析:从基础到认证的完整指南

本文系统解析了电磁兼容(EMC)标准体系,从基础概念到认证流程提供完整指南。文章阐述了EMC对于产品可靠性与市场准入的重要性,详细拆解了基础标准、通用标准、产品类标准及认证流程四层结构,并结合5G设备与工业控制等实战案例,为工程师提供了从设计初期到认证测试的高效应用策略。

weixin_29294975的博客 355

Postgres-XL集群部署

Postgres-XL集群部署服务器硬件概览软件及版本说明Postgres-XL集群结构部署过程一、系统配置准备1.1 修改计算机名称1.2 禁用系统防火墙1.3 禁用系统SeLinux1.4 配置域名地址映射二、用户操作及准备2.1 在两台服务器中分别添加postgres用户及用户组,并初始化密码2.2 配置postgres免密登录三、依赖软件安装四、Postgres-XL编译与安装五、添加用户环境变量六、编辑集群配置文件七、集群初始化与启动八 、常见问题及解决办法 服务器硬件概览 台数: 2台 系统:

qq_32368213的博客 1243

EEGLAB安装、EDF数据导入、EEG预处理(Matlab)

目录下载和安装下载安装遇到问题及解决方案导入EDF数据EEG预处理 下载和安装 下载 链接:https://pan.baidu.com/s/17eMT6B7LgZ4PyqWvD5ixmg 提取码:12gz 安装 **第一步:**将下载下来的文件解压,修改名称为eeglab,将此文件夹存放在matlab的安装目录里的toolbox文件夹下,下图是我的路径,需要拷贝到自己相对应的路径中 第二步: 打开Matlab软件,点击主页中的设置路径 设置路径 点击添加并包含子文件夹,将eeglab文件夹添加进来,保

y18771025420的博客 1万+

Unity3D实战:5分钟搞定RTSP监控视频播放(附完整代码)

本文提供了一套在Unity3D中快速集成RTSP监控视频播放的实战方案。通过采用LibVLCSharp for Unity这一成熟稳定的跨平台中间件,开发者可以轻松实现RTSP流的解码与渲染,并附有完整的C#代码示例,帮助用户在5分钟内完成集成,适用于智慧园区、安防监控等3D可视化场景。

weixin_29001655的博客 191

Postgres-XL安装与配置

接上篇《初识Postgres-XL》https://segmentfault.com/a/11...写一下Postgres-XL(简称PGXL)的部署与测试。 第一节 安装安装很简单,源码安装,和PG的安装基本相同,可能比PG多一个依赖库。在所有节点上执行相同操作。 ./configure make make install 如果执行....

weixin_34390105的博客 579

手把手教你ensp仿真搭建校园网(含防火墙及无线网络)系列(一)校园网核心交换机配置

本系列博客将带你从零开始,使用 华为 eNSP(Enterprise Network Simulation Platform) 仿真搭建一个完整的校园网络,涵盖 核心层、汇聚层、接入层、防火墙安全策略、无线AC+AP组网 等实战场景。无论你是网络初学者还是希望深化实战经验的工程师,都能通过本教程掌握企业级网络的规划、配置与排错技巧。

echo的博客 3792

关于postgresql-XL集群的入门配置

https://www.jianshu.com/p/82aaf352b772

gdhgr的博客 3606

关务管理项目专题:SAP 与关衡关务系统的进出口报关业务集成(1)需求和方案整理

一个拥有进出口业务的企业就需要报关,而关务系统就是用来辅助企业日常进出口报关,同时数字化、合规化报关业务的有效工具。本章属于关务管理项目专题系列,以 SAP 与关衡关务系统的进出口报关业务集成为实例,详细讲解报关业务的需求和方案整理。

SAP李斌,本人承诺所有原创文章均不使用任何AI生成技术,请大家放心阅读。 2075

100个Python实战项目(七)实现摩斯密码翻译器

作者主页:海拥 作者简介:优快云全栈领域优质创作者、HDZ核心组成员、蝉联C站周榜前十 粉丝福利:往期获奖记录 每周送6~9本书,不定期送各种小礼品(搪瓷杯、抱枕、鼠标垫、马克杯等) 摩斯密码是一种将文本信息作为一系列通断的音调、灯光或咔嗒声传输的方法,无需特殊设备,熟记的小伙伴即可直接翻译。它以电报发明者Samuel F. B. Morse的名字命名。 算法 算法非常简单。英语中的每个字符都被一系列“点”和“破折号”代替,或者有时只是单数的“点”或“

努力是为了站在万人之中,成为别人的光 1万+

PostgreSQL的集群化和容器化部署

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34178244的博客 5818

倍福--TwinSAFE功能块的使用

在安全模块的程序设计中,输入变量取反,或者把PLC的变量连接到安全的功能块程序中, 操作流程 1.1. 功能块输出取反 例如修改IN,右击属性,然后可在Single-Channel选项中选择是NO还是NC的输入信号。 1.2. PLC标准变量作为安全程序的输入 1.2.1. 建立两个PLC变量 1.2.2. 安全程序区创建变量 1.2.3. 功能块变量链接 首先,PLC变量不能直接连到Estop功能块的输入变量中,否则会报错,但PLC可以连接到SafeAnd这些功能块,然后再转出来,如下所示

weixin_41883890的博客 5308

Postgres-XL集群软件介绍及搭建

介绍Postgres-XL Postgres-XL 全称为 Postgres eXtensible Lattice,是TransLattice公司及其收购数据库技术公司–StormDB的产品。Postgres-XL是一个横向扩展的开源数据库集群,具有足够的灵活性来处理不同的数据库任务。 Postgres-XL功能特性 开放源代码:(源协议使用宽松的“Mozilla Public License”...

Expec-乐的博客 4675

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Postgres-XL-ubuntu系统的集群部署

  一、介绍            Postgres的的-XL是一个基于PostgreSQL的数据库的横向扩展开源SQL数据库集群。   二、组件              1、Global Transaction Monitor (GTM)                  全局事务管理器,确保群集范围内的事务一致性。 GTM负责发放事务ID和快照作为其多版本并发控制的一部分。集群可选地...

我在生活 8710

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

Postgres-XL 简析

这个项目的背后是一家叫做stormDB的公司。项目代码基于postgres-xc,开源版本应该是stormdb的一个分支。 In 2010, NTT's Open Source Software Center approached EnterpriseDB to build off of NTT OSSC's experience with a project called RitaDB and EnterpriseDB's experience with a project called Grid..

driftingman的专栏 2840

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Postgres-XL数据库集群安装

PGXL分布式集群(1GTM + 2CN + 2DN)安装实施文档。

陈泽钦的博客 967
上一篇: fmpeg/ffprobe查看音频视频文件信息并输出为json格式
下一篇: 树莓派os64位版本 ext4默认文件系统转换为btrfs的步骤
linuxchen
博客等级 码龄24年 34粉丝 96原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值