Add detailed help

master
Vitaliy Filippov 2024-05-07 16:48:04 +03:00
parent 5ac46e8363
commit 325c2bb2d9
2 changed files with 73 additions and 8 deletions

View File

@ -30,6 +30,7 @@ class AntiCluster
nodeId: this.cfg.node_id,
heartbeatTimeout: this.cfg.heartbeat_timeout,
electionTimeout: this.cfg.election_timeout,
leaderPriority: this.cfg.leader_priority||undefined,
initialTerm: this.antietcd.stored_term,
send: (to, msg) => this._sendRaftMessage(to, msg),
});

View File

@ -196,7 +196,7 @@ class AntiEtcd
}
this.clients[client_id].alive = false;
socket.ping(() => {});
}, 30000);
}, this.cfg.ws_keepalive_interval||30000);
socket.on('message', (msg) =>
{
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()
{
const options = {
@ -444,13 +514,7 @@ function parse()
const arg = process.argv[i].toLowerCase().replace(/^--(.+)$/, (m, m1) => '--'+m1.replace(/-/g, '_'));
if (arg === '-h' || arg === '--help')
{
console.error(
'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]'
);
console.error(help_text.trim());
process.exit();
}
else if (arg == '--no_persist_filter')