Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

CMS Socket Interface


 

Overview

The CUBRID Manager Server (CMS) Socket Interface is an interface that exists between the CUBRID manager server and the application client. If you want to find that a web-based application client can access the CUBRID manager server, please see CMS HTTP Interface. The CUBRID manager server delivers the request received from an application client to the CUBRID, and transfers the execution result to the client.

Socket interface only supported in CUBRID 8.x.x and 9.1.0. After CUBRID 9.2.0, CMS doesn't support socket interface anymore.

But actually, the request and response data structures are the same for socket and HTTP interfaces. So reader can refer to the HTTP interfaces page   for the details of a sepcific interface, for it is more readable.

 

 

Writing Application Program

CMS socket interface is legacy interface, client can submit request to 8001 and 8002 port, and receive the execution result.

The basic steps used for writing programs are as follows. First client must log in CMS with CUBRID Manager(DBMT) user name and password. If client login success, CMS will return a token which will be used in following request. The steps are implemented in example codes.

 

Example in telnet Request:

telnet localhost 8001

task:login

id:admin

password:admin

clientver:8.4

 

The client will receive response in a string. If success, “status” is “success”, otherwise “failure” and “note” will give error reason. The data “token” will be used in following request.

 

note : none

status : success

task : authenticate

token : ae873897a0a9a2af8ea817532a4d722b124c446cb75876b9924a258f6351977e7926f07dd201b6aa

 

 

CM Interface

CM interface use cubrid command line to get and set configure, client send request to 8002 port.

 

addvoldb

Description:

The addvoldb interface will add new volume to databases.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- volname: new volume name, if not assign, name will be assigned by cubrid.

- purpose: volume types,(data/index/temp/generic)

- path: volume saved path

- numberofpages: pages number to add

- size_need_mb: new volume size in MB

Return Value:

- status : “success” / “failure”

Example:

task:addvoldb

token:

dbname:alatestdb

volname:

purpose:generic

path:$CUBRID_DATABASES/alatestdb

numberofpages:100

size_need_mb:0.391(MB)

 

adddbmtuser

Description:

The adddbmtuser interface will create new databases dbmt user.

Syntax:

- task : task name

- token: token

- targetid: new dbmt user name.

- casauth : authorize cas user .

- dbcreate: create databases authorization.

- statusmonitorauth: monitor status authorization.

Return Value:

- status : “success” / “failure”

Example:

 

task:adddbmtuser

token:

targetid:newuser

password:*******

casauth:admin

dbcreate:none

statusmonitorauth:admin

 

backupdb

Description:

The backupdb interface will create databases backup file.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- level: backup level; default: full level

LEVEL is allowed:0 – full; 1 - incremental 1; 2 - incremental 2

- volname: backup volume name.

- backupdir: store backup volumes to directory PATH

- removelog: delete unnecessary log-archives

- check: check a consistency of the database(y/n); default: check

- mt: number of threads; default: 0(auto)

- zip: compress backup volumes; default: uncompress

Return Value:

- status : “success” / “failure”

Example:

task:backupdb

token:

dbname:alatestdb

level:0

volname:alatestdb_backup_lv0

backupdir:$CUBRID_DATABASES/alatestdb/backup

removelog:n

check:y

mt:0

zip:y

 

backupdbinfo

Description:

The backupdbinfo interface will get databases backup information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- dbdir : databases backup directory.

- freespace : disk free space (MB)

- level0/level1/level2 : backup level information

data : backup date info.

path : backup file path.

size : backup file size.

Example:

task:backupdbinfo

token:

dbname:alatestdb

 

backupvolinfo

Description:

The backupvolinfo interface will get databases backup volume information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- level : backup level

- pathname : backup file path.

Return Value:

- status : “success” / “failure”

- line : volume information.

Example:

task:backupvolinfo

token:

dbname:alatestdb

level:0

pathname:$CUBRID_DATABASES/alatestdb/backup/alatestdb_backup_lv0

 

broker_restart

Description:

The broker_restart interface will restart specified broker.

Syntax:

- task : task name

- token: token

- bname: a name of the broker

- asnum: the number of application server generated and managed by the CUBRID Broker.

Return Value:

- status : “success” / “failure”

Example:

task:broker_restart

token:

bname:query_editor

asnum:1

 

broker_start

Description:

The broker_restart interface will start specified broker.

Syntax:

- task : task name

- token: token

- bname: a name of the broker

Return Value:

- status : “success” / “failure”

Example:

task:broker_start

token:

bname:broker1

 

broker_stop

Description:

The broker_restart interface will stop specified broker.

Syntax:

- task : task name

- token: token

- bname: a name of the broker

Return Value:

- status : “success” / “failure”

Example:

task:broker_stop

token:

bname:broker1

 

checkdb

Description:

The checkdb interface will check consistency of the database.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- repairdb: repair when inconsistency is found

Return Value:

- status : “success” / “failure”

Example:

task:checkdb

token:

dbname:alatestdb

repairdb:n

 

class

Description:

The class interface will get summary databases class information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- class : class name

Return Value:

- status : “success” / “failure”

- classinfo: class information.

classname : class name

constraint : class constraint

attribute : class attribute

owner : class owner

type : class type (user/system)

virtual : is virtual class

Example:

task:class

token:

dbname:demodb

classname:athlete

 

classinfo

Description:

The classinfo interface will get detail databases class information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- systemclass: system class information.

- userclass : user class information.

Example:

task:classinfo

token:

dbname:demodb

 

compactdb

Description:

The compactdb interface will compact databases.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- verbose : show detail information (y / n)

Return Value:

- status : “success” / “failure”

- log: compact log.

Example:

task:compactdb

token:

dbname:alatestdb

verbose:y

 

copydb

Description:

The copydb interface will duplicate databases.

Syntax:

- task : task name

- token: token

- srcdbname: source databases name

- destdbname : destination databases name

- destdbpath : directory PATH for database volumes;

- exvolpath : directory PATH for extended information volumes;

- logpath : directory PATH for log volumes;

- overwrite : replace an existing database; default: don't replace

- move : delete a source database; default: don't delete

- advanced : off

Return Value:

- status : “success” / “failure”

Example:

task:copydb

token:

srcdbname:alatestdb

destdbname:destinationdb

destdbpath:$CUBRID_DATABASES/destinationdb

exvolpath:$CUBRID_DATABASES/destinationdb

logpath:$CUBRID_DATABASES/destinationdb

overwrite:y

move:n

advanced:off

 

createdb

Description:

The createdb interface will create new databases.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- numpage: size of first information volume

- pagesize: database page SIZE in bytes

- logsize: size of log archives

- logpagesize: log page SIZE in bytes

- genvolpath: directory PATH for database volumes

- logvolpath: directory PATH for log volumes

- exvol: contain specifications for creation of additional volumes

[volname]_[type]_[vol_flag] : external volume information

- overwrite_config_file : overwrite config file

Return Value:

- status : “success” / “failure”

Example:

task:createdb

token:

dbname:alatestdb

numpage:10240

pagesize:4096

logsize:10240

logpagesize:4096

genvolpath:$CUBRID_DATABASES /alatestdb

logvolpath:$CUBRID_DATABASES /alatestdb

exvol:[{alatestdb_data_x001:data;100; $CUBRID_DATABASES /alatestdb}]

overwrite_config_file:YES

 

createuser

Description:

The createuser interface will create new databases user.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- username: user name

- userpass: user password

- groups: user own groups

group : group name

- authorization : user authorization information.

Return Value:

- status : “success” / “failure”

Example:

task:createuser

token:

dbname:demodb

username:newuser

userpass:1111

open:groups

group:public

close:groups

authorization:

 

dbspaceinfo

Description:

The dbspaceinfo interface will fetch database file size.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- freespace: databases free space.

- logpagesize: databases log page size.

- pagesize : databases page size.

- spaceinfo: databases detail space information.

location: database location.

date : volume create date.

freepage : volume free page size.

spacename : volume name.

totalpage: volume total pages.

type : volume type (GENERIC/DATA/Archive_log)

Example:

task:dbspaceinfo

token:

dbname:alatestdb

 

deletebroker

Description:

The deletebroker interface delete specified database broker.

Syntax:

- task : task name

- token: token

- bname: a name of the broker

Return Value:

- status : “success” / “failure”

Example:

task:deletebroker

token:

bname:broker_test

 

deletedbmtuser

Description:

The deletedbmtuser interface delete specified dbmt user.

Syntax:

- task : task name

- token: token

- targetid: a name of the dbmt user

Return Value:

- status : “success” / “failure”

Example:

task:deletedbmtuser

token:

targetid:newuser

 

deletedb

Description:

The deletedb interface will delete databases.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- delbackup : whether delete backup files. (y / n)

Return Value:

- status : “success” / “failure”

Example:

task:deletedb

token:

dbname:alatestdb

delbackup:y

 

deleteuser

Description:

The deleteuser interface will delete databases user.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- username : user name which will be deleted

Return Value:

- status : “success” / “failure”

Example:

task:deleteuser

token:

dbname:demodb

username:newuser

 

getbackuplist

Description:

The getbackuplist interface will fetch databases backup information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- level0 : level 0 backup file path

- leve1 : level 1 backup file path

- level2 : level 2 backup file path

Example:

task:getbackuplist

token:

dbname:alatestdb

 

getbrokersinfo

Description:

The getbrokersinfo interface will fetch databases brokers information.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

- brokersinfo : brokers information

broker : one broker information

- brokerstatus : broker service status. (ON / OFF)

Example:

task:getbrokersinfo

token:

 

getbrokerstatus

Description:

The getbrokerstatus interface will fetch databases brokers status.

Syntax:

- task : task name

- token: token

- bname: broker name

Return Value:

- status : “success” / “failure”

- asinfo : broker status information

- time: broker status query time

Example:

task:getbrokerstatus

token:

bname:query_editor

 

getcmsenv

Description:

The getcmsenv interface will fetch cubrid manager server runtime environment information.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

- CMS_VER : CUBRID manager server version

- CUBRIDVER: CUBRID version

- PLATFORM: server platform (x86/x64)

- https_cm_port: cubrid manager server port number

- https_port: cubrid https port number

Example:

task:getcmsenv

token:

 

getdbmtuserinfo

Description:

The getdbmtuserinfo interface will fetch cubrid manager information.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

- dblist : databases list in server

- userlist: dbmt user list

user : dbmt user information

@id : user name

@passwd : user password

casauth : cas authorization mode

dbauth : databases authorization informate

dbcreate: create database user authorization

statusmonitorauth: status monitor authorization

Example:

task:getdbmtuserinfo

token:

 

getdbprocstat

Description:

The getdbprocstat interface fetch databases process statistics.

Syntax:

- task : task name

- token: token

- dbname: a name of the database, none for all databases

Return Value:

- status : “success” / “failure”

- dbstat: databases process statistics

cpu_kernel: cpu used time in kernel

cpu_user: cpu used time in user.

mem_physical: physical memory used size.

mem_virtual: virtual memory used size.

Example:

task:getdbprocstat

token:

dbname:

 

getdbsize

Description:

The getdbsize interface will fetch database used disk space size.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- dbsize: databases used disk space size(B)

Example:

task:getdbsize

token:

dbname:demodb

 

getenv

Description:

The getenv interface will fetch database environment information.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

- BROKERVER: broker version

- CUBRID: cubrid file path

- CUBRIDVER: cubrid version

- CUBRID_DATABASES: cubrid databases file path

- CUBRID_DBMT: cubrid manager path

- HOSTMONTAB0: monitor tab 0

- HOSTMONTAB1: monitor tab 1

- HOSTMONTAB2: monitor tab 2

- HOSTMONTAB3: monitor tab 3

Example:

task:getenv

token:

 

gethoststat

Description:

The gethoststat interface fetch localhost server statistics.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

- cpu_idle: databases process statistics

- cpu_iowait: cpu io wait time

- cpu_kernel: cpu used time in kernel

- cpu_user: cpu used time in user.

- mem_phy_free: physical memory free size

- mem_phy_total: physical memory total size.

- mem_swap_free: swap memory free size.

- mem_swap_total: swap memory total size.

Example:

task:gethoststat

token:

 

getsysdiskinfo

Description:

The getsysdiskinfo interface fetches localhost server disk statistics.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

- disk_info: databases disk statistics

name : disk or partitions name

free_size : disk or partitions free size.

total_size: disk or partitions total size.

Example:

task:getsysdiskinfo

token:

 

gettransactioninfo

Description:

The gettransactioninfo interface fetches databases transactions information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- transactioninfo: databases transactions information

tranindex: transactions index

user : user name of transaction.

host: host name of transactions.

pid: transactions process id.

program: program name of transactions

Example:

task:gettransactioninfo

token:

dbname:demodb

 

killtransaction

Description:

The killtransaction interface stop specified databases transaction.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- type: type of parameter, t – index, u – user, h – hostname, pg – program name

- parameter: kill parameter.

Return Value:

- status : “success” / “failure”

Example:

task:killtransaction

token:

dbname:demodb

type:t

parameter:2(+)

 

loaddb

Description:

The loaddb interface will load database from files.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- checkoption : check syntax for data file or not

- period : insertion COUNT for periodic commit

- user: load databases user name

- estimated: estimated NUMBER of instances; default: none

- oiduse: use OID

- nolog: don’t create log

- schema: schema file path

- object: object file path

- index: index file path

- errorcontrolfile: FILE to control error(s) during loading

- ignoreclassfile: input file of class names that skip load

- delete_orignal_files: delete original file after load

Return Value:

- status : “success” / “failure”

- line : load db log

Example:

task:loaddb

token:

dbname:alatestdb

checkoption:both

period:none

user:dba

estimated:none

oiduse:yes

nolog:no

schema:$CUBRID_DATABASES/demodb/demodb_schema

object:$CUBRID_DATABASES /demodb/demodb_objects

index:none

errorcontrolfile:none

ignoreclassfile:none

delete_orignal_files:y

 

login

Description:

The loaddb interface will load database from files.

Syntax:

- task : task name

- token: token

- id: dbmt user name

- password: dbmt user password

- clientver: client version

Return Value:

- status : “success” / “failure”

- token : connect token

Example:

task:login

token:

id:admin

password:admin

clientver:8.4

 

optimizedb

Description:

The optimized interface optimize a database or class.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- classname: specified class name, none for all class

Return Value:

- status : “success” / “failure”

Example:

task:optimizedb

token:

dbname:alatestdb

classname:

 

renamedb

Description:

The renamedb interface will rename database.

Syntax:

- task : task name

- token: token

- dbname: source database name

- rename: database new name

- exvolpath: directory PATH for extended information volumes

- advanced: renaming volumes over several locations written in the control file

- volume: databases volume save path

- forcedel: force delete original db

Return Value:

- status : “success” / “failure”

Example:

task:renamedb

token:

dbname:destinationdb

rename:anotherdb

exvolpath:none

advanced:on

volume:$CUBRID_DATABASES/destinationdb/destinationdb:$CUBRID_DATABASES/anotherdb/anotherdb

forcedel:y

 

restoredb

Description:

The restoredb interface will restore database from backup.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- date: restore the database up to its condition at given DATE,

DATE is given as follows: dd-mm-yyyy:hh:mm:ss. none is backup time.

- level: LEVEL of backup to be restored

- partial: perform partial recovery if any log archive is absent

- pathname: PATH is a directory of backup volumes to be restored

- recoverypath: restore the database and log volumes to the path specified in the database location file

Return Value:

- status : “success” / “failure”

Example:

task:restoredb

token:

dbname:alatestdb

date:none

level:0

partial:y

pathname:$CUBRID_DATABASES /alatestdb/backup/alatestdb_backup_lv0

recoverypath:$CUBRID_DATABASES /alatestdb

 

setdbmtpasswd

Description:

The setdbmtpasswd interface reset dbmt user password.

Syntax:

- task : task name

- token: token

- targetid: dbmt user name.

- newpassword: dbmt user new password.

Return Value:

- status : “success” / “failure”

- dblist: same as getdbmtuserinfo interface.

- userlist: same as getdbmtuserinfo interface

Example:

task:setdbmtpasswd

token:

targetid:admin

newpassword:admin

 

startbroker

Description:

The startbroker interface start all brokers of databases.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

Example:

task:startbroker

token:

 

stopbroker

Description:

The stopbroker interface stop all brokers of databases.

Syntax:

- task : task name

- token: token

Return Value:

- status : “success” / “failure”

Example:

task:stopbroker

token:

 

startdb

Description:

The startdb interface will start database server.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

Example:

task:startdb

token:

dbname:alatestdb

 

startinfo

Description:

The startinfo interface will fetch database running status.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- activelist: active databases list

- dblist: databases in server

dbs: database information

dbname: database name

dbdir: database file saved path

Example:

task:startinfo

token:

 

stopdb

Description:

The stopdb interface will stop database running server.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

Example:

task:stopdb

token:

dbname:alatestdb

 

unloaddb

Description:

The unloaddb interface will unload database server.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- targetdir: PATH of output directory

- usehash: whether use hash file, (yes/no), if yes, hashdir is valid.

- hashdir: FILE for hash; default: generate by tmpnam()

- target: unload schema/object or both

- class: unload class list

classname: unload class name

- ref: include referenced tables;

- classonly: include specified class only

- delimit: use '"' where an identifier begins and ends; default: don't use

- estimate: estimated NUMBER of instances; default: auto computed

- prefix: PREFIX for output files; default: the database name

- cach: NUMBER of cached pages; default: 100

- lofile: lo file COUNT per a directory; default: 0

Return Value:

- status : “success” / “failure”

Example:

task:unloaddb

token:

dbname:demodb

targetdir:$CUBRID_DATABASES /demodb

usehash:no

hashdir:none

target:both

open:class

classname:code

close:class

ref:no

classonly:no

delimit:no

estimate:none

prefix:none

cach:none

lofile:none

 

updatedbmtuser

Description:

The updatedbmtuser interface will update dbmt user information.

Syntax:

- task : task name

- token: token

- targetid: dbmt user name

- casauth : authorize cas user .

- dbcreate: create databases authorization.

- statusmonitorauth: monitor status authorization.

- dbauth : access of databases.

dbid : databases operator user.

dbpassword : databases user password.

dbbrokeraddress: databases broker address and port

Return Value:

- status : “success” / “failure”

- dblist: same as getdbmtuserinfo.

- userlist: same as getdbmtuserinfo.

Example:

task:updatedbmtuser

token:

targetid:admin

open:dbauth

dbname:demodb

dbid:dba

dbpassword:

dbbrokeraddress:localhost33000

close:dbauth

casauth:admin

dbcreate:admin

statusmonitorauth:admin

 

updateuser

Description:

The updateuser interface will update database user information.

Syntax:

- task : task name

- token: token

- dbname: source databases name

- username: user name

- userpass: user password

- groups: user own groups

group : group name

- authorization : user authorization information.

Return Value:

- status : “success” / “failure”

Example:

task:updateuser

token:

dbname:demodb

username:newuser

userpass:******

open:groups

group:public

close:groups

authorization:

 

userinfo

Description:

The userinfo interface will fetch database user information.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

Return Value:

- status : “success” / “failure”

- user: user information

@id: user id

@name: user name

authorization: user authorization information

groups: user groups

Example:

task:userinfo

token:

dbname:demodb

 

 

analyzecaslog

Description:

The analyzecaslog interface will fetch top list to parse broker sql log(s) with the broker_log_top utility.

Syntax:

- task : task name

- token: token

- dbname: a name of the database

- logfile: a name of the log file

- option_t: y or n (y : analyze with a transaction based)

Return Value:

- status : “success” / “failure”

- resultlist : array of qindex, max, min, avg, cnt, err data

- resultfile : sql file (You can load this sql with getcaslogtopresult api.)

Example:

 

task:analyzecaslog

token:

open:logfilelist

logfile:C:\CUBRID\log\broker\sql_log/query_editor_1.sql.log

logfile:C:\CUBRID\log\broker\sql_log/query_editor_2.sql.log

close:logfilelist

option_t:no

 

 

 

getcaslogtopresult

Description:

The getcaslogtopresult interface will fetch broker sql log by specific index with the broker_log_top utility.

Syntax:

- task : task name

- token: token

- filename: a name of the database

- qindex: an index (such as [Q1]) from the analyzecaslog api

Return Value:

- status : “success” / “failure”

- logstring: broker logs

Example:

 

task:getcaslogtopresult

token:

filename:C:\CUBRID/tmp/analyzelog_12532.res

qindex:[Q1]

comments powered by Disqus
Page info
viewed 1547 times
translations en
Author
posted last year by
newpcraft
Contributors
updated last year by
View revisions
tagged
Share this article