How to set up a demo cluster inside a single physical server.

Asked by Xiaobo Gu

Hi,

I am trying to set up a demo cluster within a single server. The idea is to start 2 data node PostgreSQL instance on different ports, such as 5402 and 5403, the default port 5432 will be running the default PostgreSQL instance to hold the metadata database, then how should me specify the options inside stado.config, my plan is as following:

        xdb.nodecount=3

        ### Individual node info
        ### 192.168.56.11 is the local IP

        xdb.node.1.dbhost=192.168.56.11
        xdb.node.2.dbhost=192.168.56.11
        xdb.node.3.dbhost=192.168.56.11

        ### Designate coordinator node
        ### In practice, the coordinator node should be the node where
        ### the Stado database is running.

        xdb.coordinator.node=1

       xdb.node.2.dbport=5402
       xdb.node.3.dbport=5403

Does this work?

Regards

Question information

Language:
English Edit question
Status:
Answered
For:
Stado Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Xiaobo Gu (guxiaobo1982) said :
#1

I read some old threads, it seems it should something like this:

         xdb.nodecount=3

         ### Individual node info
         ### 192.168.56.11 is the local IP

         xdb.node.1.dbhost=192.168.56.11
         xdb.node.2.dbhost=192.168.56.11
         xdb.node.3.dbhost=192.168.56.11

        ### Designate coordinator node
         ### In practice, the coordinator node should be the node where
         ### the Stado database is running.

        xdb.coordinator.node=1

       xdb.node.1.dbport=5401
       xdb.node.2.dbport=5402
       xdb.node.3.dbport=5403

So there should be 4 PostgreSQL instances running , the default one on port 5432 will hold the metadata database, 5401 for the coordinator db, and 5402,5403 for data nodes.

Is that true?

Revision history for this message
Mason Sharp (mason-sharp) said :
#2

You don't even need to run separate PostgreSQL instances. Stado will generate unique names for the database, so if you have 3 nodes, it will create 3 databases with different names within the same instance. It makes development easier in particular. :-)

Revision history for this message
Mason Sharp (mason-sharp) said :
#3

To clarify, you can have all 3 use the same host and port if you want.

Revision history for this message
Xiaobo Gu (guxiaobo1982) said :
#5

Hi Mason,

Thanks for your reply, but there is a situation,

When I create the xtest user database, the __xtest__N2 and __xtest__N3 database are all created inside the metadata PostgreSQL instance.

gs-createdb.sh -d xtest -u admin -p secret -n 2,3

My stado.config is as following:

###########################################################################
# Copyright (c) 2010 EnterpriseDB Corporation
# Copyright (c) 2011 Stado Global Development Group
#
# stado.config
#
# Stado configuration file
###########################################################################

###
### Server settings
###

xdb.port=6453
xdb.maxconnections=10

###
### Node & JDBC Pool configuration
###

### Set defaults for all nodes and MetaData database.
### These can be overriden.

xdb.default.dbusername=stado
xdb.default.dbpassword=stado

xdb.default.dbport=5400

### Connection thread defaults for each node
### Note that these are pooled, so the number of clients connected
### to stado can be greater than pool size.

xdb.default.threads.pool.initsize=5
xdb.default.threads.pool.maxsize=10

### Connectivity for MetaData database

xdb.metadata.database=XDBSYS
xdb.metadata.dbhost=192.168.56.11
xdb.metadata.dbport=5400

### The number of nodes in cluster

xdb.nodecount=3

### The hosts of the underlying databases

xdb.node.1.dbhost=192.168.56.11
xdb.node.2.dbhost=192.168.56.11
xdb.node.3.dbhost=192.168.56.11

xdb.node.1.dbport=5401
xdb.node.2.dbport=5402
xdb.node.3.dbport=5403

### Designate coordinator node number
### In practice, the coordinator node should be the node where
### Stado is running.

xdb.coordinator.node=1

###
### The next few sections are required when wanting to run agents on the nodes.
### Uncomment them and modify to communicate with agents
###

### Only for agent version
### Port for node's SocketCommunicator

#xdb.node.1.port=5401
#xdb.node.1.host=192.168.56.11
#xdb.node.2.port=5402
#xdb.node.2.host=192.168.56.11
#xdb.node.3.port=5403
#xdb.node.3.host=192.168.56.11

### Designate coordinator node
### In practice, the coordinator node should be the node where
### Stado is running.

#xdb.coordinator.host=192.168.56.11
#xdb.coordinator.port=6454

# Specify protocol types.
# Can use local connection between coordinator and node 1,
# since they are the same system

#xdb.connector.0.1=0
#xdb.connector.1.0=0

###
### Logging Settings
###

### The log4j library is used.
### More info at http://logging.apache.org/log4j/docs/

# rootLogger. Log warnings and errors.
log4j.rootLogger=WARN, console

# Define other characteristics for console log
log4j.appender.console=org.apache.log4j.RollingFileAppender
log4j.appender.console.maxFileSize=500KB
log4j.appender.console.maxBackupIndex=10
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ISO8601} - %-5p %m%n
log4j.appender.console.File=../log/console.log

# Log Server messages to the console logger
log4j.logger.Server=ALL, console

# Query logger.
# This logs all queries sent to the database.
log4j.logger.query=INFO, QUERY
log4j.appender.QUERY=org.apache.log4j.RollingFileAppender
log4j.appender.QUERY.File=../log/query.log
log4j.appender.QUERY.maxFileSize=500KB
log4j.appender.QUERY.maxBackupIndex=10
log4j.appender.QUERY.layout=org.apache.log4j.PatternLayout
log4j.appender.QUERY.layout.ConversionPattern=%d{ISO8601} - %m%n

# Activity logger.
# This logs grid activity
log4j.logger.activity=INFO, activity
log4j.appender.activity=org.apache.log4j.RollingFileAppender
log4j.appender.activity.File=../log/activity.log
log4j.appender.activity.maxFileSize=10MB
log4j.appender.activity.maxBackupIndex=10
log4j.appender.activity.layout=org.apache.log4j.PatternLayout
log4j.appender.activity.layout.ConversionPattern=%d{ISO8601} - %m%n

# Uncomment this if you would like other SQL commands other
# than SELECT to be logged in the query logger as well
# (e.g. INSERT, UPDATE, DELETE).

#log4j.logger.command=INFO, QUERY

# A separate "long query" log may be defined to separately log queries
# that appear to be be taking a long time.
# Specify the threshold in seconds at which queries will show up in the
# long query log.
xdb.longQuerySeconds=300

log4j.logger.longquery=INFO, LONGQUERY
log4j.appender.LONGQUERY=org.apache.log4j.RollingFileAppender
log4j.appender.LONGQUERY.File=../log/longqry.log
log4j.appender.LONGQUERY.maxFileSize=500KB
log4j.appender.LONGQUERY.maxBackupIndex=10
log4j.appender.LONGQUERY.layout=org.apache.log4j.PatternLayout
log4j.appender.LONGQUERY.layout.ConversionPattern=%d{ISO8601} - %m%n

### User defined functions: subdate, adddate

xdb.sqlfunction.subdate.template=DATE({arg1})-INTERVAL '{arg2} days'
xdb.sqlfunction.subdate.returntype=DATE
xdb.sqlfunction.subdate.paramcount=2
xdb.sqlfunction.subdate.arg1=DATE
xdb.sqlfunction.subdate.arg2=ANYNUMBER

xdb.sqlfunction.adddate.template=DATE({arg1})+INTERVAL '{arg2} days'
xdb.sqlfunction.adddate.returntype=DATE
xdb.sqlfunction.adddate.paramcount=2
xdb.sqlfunction.adddate.arg1=ANYDATE
xdb.sqlfunction.adddate.arg2=ANYNUMBER

Revision history for this message
Xiaobo Gu (guxiaobo1982) said :
#6

I am sorry for double clicking the submit button

Revision history for this message
Xiaobo Gu (guxiaobo1982) said :
#7

Hi,
There are some more infomations:

1. The above results are based on actions that following:
 a) All 4 PostgreSQL instances are running well
 b)First create the metadatabase inside metadb instance, and execute the gs-createmddb.sh -m -u admin -p secret command
 c)start the server using : gs-server.sh
 d) Did not start andy agents.

2.Then I do the following test with the same stado.config file:

 a) All 4 PostgreSQL instances are running well
 b)[stado@lix bin]$ gs-createmddb.sh -u admin -p secret
     Executed Statement: create table xsystablespaces ( tablespaceid serial, tablespacename varchar(255) not null, ownerid int not null, primary key(tablespaceid))
.......

Executed Statement: alter table xsyschecks add foreign key (constid) references xsysconstraints (constid)
User admin is created
c)[stado@lix bin]$ gs-server.sh -x -a
Starting....
Error starting XDBServer
 server.log output:
java.lang.NullPointerException
        at org.postgresql.stado.metadata.MetaData.getNodeDBConnectionInfos(Unknown Source)
        at org.postgresql.stado.server.Server.getNodeDBConnectionInfos(Unknown Source)
        at org.postgresql.stado.util.XdbServer.main(Unknown Source)

 tail of console.log output:
2013-07-22 09:15:10,036 - INFO Coordinator: Node 3 is connected
2013-07-22 09:15:10,036 - INFO Coordinator: Node 3 is connected
2013-07-22 09:15:10,039 - INFO Coordinator: Node 2 is connected
2013-07-22 09:15:10,039 - INFO Coordinator: Node 2 is connected
2013-07-22 09:15:10,040 - INFO Coordinator: Node 1 is connected
2013-07-22 09:15:10,040 - INFO Coordinator: Node 1 is connected
[stado@lix bin]$

Then I looked the log files

[stado@lix stado-2.5]$ dir
bin config doc lib license log
[stado@lix stado-2.5]$ cd log
[stado@lix log]$ ls
activity.log console.log longqry.log query.log server.log
[stado@lix log]$ more activity.log
[stado@lix log]$ more console.log
2013-07-22 09:15:10,036 - INFO Coordinator: Node 3 is connected
2013-07-22 09:15:10,036 - INFO Coordinator: Node 3 is connected
2013-07-22 09:15:10,039 - INFO Coordinator: Node 2 is connected
2013-07-22 09:15:10,039 - INFO Coordinator: Node 2 is connected
2013-07-22 09:15:10,040 - INFO Coordinator: Node 1 is connected
2013-07-22 09:15:10,040 - INFO Coordinator: Node 1 is connected
[stado@lix log]$ more longqry.log
[stado@lix log]$ more query.log
[stado@lix log]$ more server.log
java.lang.NullPointerException
        at org.postgresql.stado.metadata.MetaData.getNodeDBConnectionInfos(Unknown Source)
        at org.postgresql.stado.server.Server.getNodeDBConnectionInfos(Unknown Source)
        at org.postgresql.stado.util.XdbServer.main(Unknown Source)
[stado@lix log]$

Revision history for this message
Alvin Peng (pengalvin) said :
#8

To use the "-x" option, you may need to specify the database name with "-d" option.
And in stado.config, you need to configure the "xdb.gateway.startdb" value.

Per my understanding, the "-x" option is to start the underlying databases.
Actually, the datanodes are running before you start gs-server, so you don't need "-x".
gs-server.sh -a (for all databases) or
gs-server.sh -d xtest (for database xtest) is ok.

For more information about stado, you may want to read the documents in stado/doc.

Can you help with this problem?

Provide an answer of your own, or ask Xiaobo Gu for more information if necessary.

To post a message you must log in.