Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page:

Changing the shard Configurations

shard.conf

Change shard.conf, the default configuration file, as shown below:

Caution: The port number and the shared memory identifier should be appropriately changed to the value which has not been assigned by the system.

[shard]

MASTER_SHM_ID           =45501

ADMIN_LOG_FILE          =log/broker/cubrid_broker.log

 

[%shard1]

SERVICE                 =ON

BROKER_PORT             =45511

MIN_NUM_APPL_SERVER     =1  

MAX_NUM_APPL_SERVER     =1  

APPL_SERVER_SHM_ID      =45511

LOG_DIR                 =log/broker/sql_log

ERROR_LOG_DIR           =log/broker/error_log

SQL_LOG                 =ON

TIME_TO_KILL            =120

SESSION_TIMEOUT         =300

KEEP_CONNECTION         =ON

MAX_PREPARED_STMT_COUNT =1024

SHARD_DB_NAME           =shard1

SHARD_DB_USER           =shard

SHARD_DB_PASSWORD       =shard123

NUM_PROXY_MIN           =1  

NUM_PROXY_MAX           =1  

PROXY_LOG_FILE          =log/broker/proxy_log

PROXY_LOG               =ALL

MAX_CLIENT              =10

METADATA_SHM_ID         =45591

SHARD_CONNECTION_FILE   =shard_connection.txt

SHARD_KEY_FILE          =shard_key.txt

For CUBRID, the server port number is not separately configured in the shard_connection.txt but the cubrid_port_id parameter of the cubrid.conf configuration file is used. Therefore, set the cubrid_port_id parameter of the cubrid.conf identical to the server.

# TCP port id for the CUBRID programs (used by all clients).

cubrid_port_id=41523

shard_key.txt

Set shard_key.txt, the shard DB mapping configuration file, for the shard key hash value as follows:

  • [%shard_key]: Sets the shard key section
  • Executing the query at shard #0 when the shard key hash result created by default hash function is between 0 and 63
  • Executing the query at shard #1 when the shard key hash result created by default hash function is between 64 and 127
  • Executing the query at shard #2 when the shard key hash result created by default hash function is between 128 and 191
  • Executing the query at the shard #3 when the shard key hash result created by default hash function is between 192 and 255

[%shard_key]

#min    max     shard_id

0       63      0

64      127     1

128     191     2

192     255     3

shard_connection.txt

Configure the shard_connection.txt file which is shard database configuration file, as follows:

  • Real database name and connection information of shard #0
  • Real database name and connection information of shard #1
  • Real database name and connection information of shard #2
  • Real database name and connection information of shard #3

# shard-id  real-db-name  connection-info

#                         * cubrid : hostname, hostname, ...

#                         * mysql  : hostname:port

0           shard1        HostA

1           shard1        HostB

2           shard1        HostC

3           shard1        HostD

Note: HostA, HostB and so forth represents the IP address of the server. Example: localhost, 127.0.0.1, 85.9.10.3