-
Notifications
You must be signed in to change notification settings - Fork 33
pman command: DBctl
Rudolph Pienaar edited this page Jun 7, 2018
·
2 revisions
This page describes the DBctl
command to pman
. It is used to control the internal DB state.
- A HOST_IP environment variable that denotes the IP of the host housing the service. In Linux, you can do:
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
- Make sure that
pman
has been started (see here for more info):
pman --rawmode 1 --http --port 5010 --listeners 12
The internal database can be saved by sending a save
command to pman
.
pfurl --verb POST --raw --http ${HOST_IP}:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
'{ "action": "DBctl",
"meta": {
"do": "save"
}
}' --quiet --jsonpprintindent 4
A different save destination can also be specified:
pfurl --verb POST --raw --http ${HOST_IP}:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
'{ "action": "DBctl",
"meta": {
"do": "save",
"dbpath": "/tmp/pmanDB"
}
}' --quiet --jsonpprintindent 4
The internal database can be cleared by sending a clear
command to pman
. This should erase the data in the persistent storage, as well as the internal memory.
pfurl --verb POST --raw --http ${HOST_IP}:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
'{ "action": "DBctl",
"meta": {
"do": "clear"
}
}' --quiet --jsonpprintindent 4
The returned JSON string from the call:
{
"payloadsize": 90,
"RESTverb": "POST",
"action": "hello",
"meta": {
"askAbout": "sysinfo",
"echoBack": "Hi there!"
},
"RESTheader": "POST /api/v1/cmd HTTP/1.1\r",
"path": "/api/v1/cmd",
"status": true,
"receivedByServer": [
"POST /api/v1/cmd HTTP/1.1\r",
"Host: 172.17.0.2:5010\r",
"User-Agent: PycURL/7.43.0 libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3\r",
"Accept: */*\r",
"Content-type: application/vnd.collection+json\r",
"Content-Length: 90\r",
"\r",
"{\"payload\": {\"action\": \"hello\", \"meta\": {\"askAbout\": \"sysinfo\", \"echoBack\": \"Hi there!\"}}}"
],
"d_ret": {
"sysinfo": {
"memory": [
67422126080,
55895048192,
17.1,
10516230144,
48169099264,
14141243392,
3601956864,
808980480,
7927816192,
461950976
],
"platform": "Linux-4.4.0-64-generic-x86_64-with-Ubuntu-16.04-xenial",
"hostname": "ab570dec6043",
"cpu_percent": 5.6,
"loadavg": [
1.37,
1.11,
0.99
],
"uname": [
"Linux",
"ab570dec6043",
"4.4.0-64-generic",
"#85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017",
"x86_64",
"x86_64"
],
"version": "#85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017",
"system": "Linux",
"cpucount": 24,
"machine": "x86_64"
}
}
}
--30--