Add detailed help
parent
258f0d7d1f
commit
6e553e3eef
|
@ -30,6 +30,7 @@ class AntiCluster
|
||||||
nodeId: this.cfg.node_id,
|
nodeId: this.cfg.node_id,
|
||||||
heartbeatTimeout: this.cfg.heartbeat_timeout,
|
heartbeatTimeout: this.cfg.heartbeat_timeout,
|
||||||
electionTimeout: this.cfg.election_timeout,
|
electionTimeout: this.cfg.election_timeout,
|
||||||
|
leaderPriority: this.cfg.leader_priority||undefined,
|
||||||
initialTerm: this.antietcd.stored_term,
|
initialTerm: this.antietcd.stored_term,
|
||||||
send: (to, msg) => this._sendRaftMessage(to, msg),
|
send: (to, msg) => this._sendRaftMessage(to, msg),
|
||||||
});
|
});
|
||||||
|
|
80
antietcd.js
80
antietcd.js
|
@ -196,7 +196,7 @@ class AntiEtcd
|
||||||
}
|
}
|
||||||
this.clients[client_id].alive = false;
|
this.clients[client_id].alive = false;
|
||||||
socket.ping(() => {});
|
socket.ping(() => {});
|
||||||
}, 30000);
|
}, this.cfg.ws_keepalive_interval||30000);
|
||||||
socket.on('message', (msg) =>
|
socket.on('message', (msg) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -434,6 +434,76 @@ function vitastor_persist_filter(prefix)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const help_text = `Miniature etcd replacement based on TinyRaft
|
||||||
|
(c) Vitaliy Filippov, 2024
|
||||||
|
License: Mozilla Public License 2.0
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
${process.argv[0]} ${process.argv[1]}
|
||||||
|
[--cert ssl.crt] [--key ssl.key] [--port 12379]
|
||||||
|
[--data data.gz] [--vitastor-persist-filter /vitastor] [--no-persist-filter] [--persist_interval 500]
|
||||||
|
[--node_id node1 --cluster_key abcdef --cluster node1=http://localhost:12379,node2=http://localhost:12380,node3=http://localhost:12381]
|
||||||
|
[other options]
|
||||||
|
|
||||||
|
Supported etcd REST APIs:
|
||||||
|
|
||||||
|
/v3/kv/txn /v3/kv/put /v3/kv/range /v3/kv/deleterange
|
||||||
|
/v3/lease/grant /v3/lease/keepalive /v3/lease/revoke /v3/kv/lease/revoke
|
||||||
|
websocket-based watch API (create_request, cancel_request, progress_request)
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
HTTP:
|
||||||
|
|
||||||
|
--port 2379
|
||||||
|
Listen port
|
||||||
|
--cert <filename>
|
||||||
|
Use TLS with this certificate file (PEM format)
|
||||||
|
--key <filename>
|
||||||
|
Use TLS with this key file (PEM format)
|
||||||
|
--ws_keepalive_interval 30000
|
||||||
|
Client websocket ping (keepalive) interval in milliseconds
|
||||||
|
|
||||||
|
Persistence:
|
||||||
|
|
||||||
|
--data <filename>
|
||||||
|
Use <filename> to store persistent data
|
||||||
|
--persist_interval <milliseconds>
|
||||||
|
Persist data on disk after this interval, not immediately
|
||||||
|
--no_persist_filter
|
||||||
|
Store all data
|
||||||
|
--vitastor_persist_filter <prefix>
|
||||||
|
Store only data required for Vitastor with prefix <prefix> on disk
|
||||||
|
|
||||||
|
Clustering:
|
||||||
|
|
||||||
|
--node_id <id>
|
||||||
|
ID of this cluster node
|
||||||
|
--cluster <id1>=<url1>,<id2>=<url2>,...
|
||||||
|
All other cluster nodes
|
||||||
|
--cluster_key <key>
|
||||||
|
Shared cluster key for identification
|
||||||
|
--election_timeout 5000
|
||||||
|
Raft election timeout
|
||||||
|
--heartbeat_timeout 1000
|
||||||
|
Raft leader heartbeat timeout
|
||||||
|
--leader_priority <number>
|
||||||
|
Raft leader priority for this node (optional)
|
||||||
|
--stale_read 0|1
|
||||||
|
Allow to serve reads from followers
|
||||||
|
--reconnect_interval 1000
|
||||||
|
Unavailable peer connection retry interval
|
||||||
|
--dump_timeout 5000
|
||||||
|
Timeout for dump command in milliseconds
|
||||||
|
--load_timeout 5000
|
||||||
|
Timeout for load command in milliseconds
|
||||||
|
--forward_timeout 1000
|
||||||
|
Timeout for forwarding requests from follower to leader in milliseconds
|
||||||
|
--replication_timeout 1000
|
||||||
|
Timeout for replicating requests from leader to follower in milliseconds
|
||||||
|
`;
|
||||||
|
|
||||||
function parse()
|
function parse()
|
||||||
{
|
{
|
||||||
const options = {
|
const options = {
|
||||||
|
@ -444,13 +514,7 @@ function parse()
|
||||||
const arg = process.argv[i].toLowerCase().replace(/^--(.+)$/, (m, m1) => '--'+m1.replace(/-/g, '_'));
|
const arg = process.argv[i].toLowerCase().replace(/^--(.+)$/, (m, m1) => '--'+m1.replace(/-/g, '_'));
|
||||||
if (arg === '-h' || arg === '--help')
|
if (arg === '-h' || arg === '--help')
|
||||||
{
|
{
|
||||||
console.error(
|
console.error(help_text.trim());
|
||||||
'USAGE:\n '+process.argv[0]+' '+process.argv[1]+' [OPTIONS]\n'+
|
|
||||||
'OPTIONS:\n'+
|
|
||||||
' [--cert ssl.crt] [--key ssl.key] [--port 12379]\n'+
|
|
||||||
' [--data data.gz] [--vitastor-persist-filter /vitastor] [--no-persist-filter] [--persist_interval 500]\n'+
|
|
||||||
' [--node_id node1 --cluster_key abcdef --cluster node1=http://localhost:12379,node2=http://localhost:12380,node3=http://localhost:12381]'
|
|
||||||
);
|
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
else if (arg == '--no_persist_filter')
|
else if (arg == '--no_persist_filter')
|
||||||
|
|
Loading…
Reference in New Issue