diff --git a/README.MD b/README.MD index fa562d01..1e684210 100644 --- a/README.MD +++ b/README.MD @@ -9,19 +9,19 @@ Open four terminals. In terminal 1: ``` -go run cmd/pranadb/main.go -conf cfg/example.conf -node 0 +go run cmd/pranadb/main.go --config cfg/example.conf --node-id 0 ``` In terminal 2: ``` -go run cmd/pranadb/main.go -conf cfg/example.conf -node 1 +go run cmd/pranadb/main.go --config cfg/example.conf --node-id 1 ``` In terminal 3: ``` -go run cmd/pranadb/main.go -conf cfg/example.conf -node 3 +go run cmd/pranadb/main.go --config cfg/example.conf --node-id 2 ``` In terminal 4, start the CLI diff --git a/cfg/example.conf b/cfg/example.conf index 0c88cc0a..dd460c0a 100644 --- a/cfg/example.conf +++ b/cfg/example.conf @@ -1,57 +1,56 @@ // Example Prana server configuration file -{ - // NodeID is not specified in the config file, it is specified on the command line. This allows you to use - // the same config file for each node in the cluster - - "ClusterID": 12345, // Each node in the same Prana cluster must have the same ClusterID, there can be multiple Prana clusters on your network - - // RaftAddresses are the addresses used by Dragonboat to form Raft clusters. They can be local to your network - "RaftAddresses": [ - "localhost:63201", - "localhost:63202", - "localhost:63203" - ], - - // Each node of the cluster listens for notifications from other nodes - these are the addresses they listen at - "NotifListenAddresses": [ - "localhost:63301", - "localhost:63302", - "localhost:63303" - ], - - // These are the addresses the API server listens at on each node - these is used for connecting from clients - "APIServerListenAddresses": [ - "localhost:6584", - "localhost:6585", - "localhost:6586" - ], - - "NumShards": 30, // Numshards is the total number of shards in the cluster - "ReplicationFactor": 3, // The number of replicas - each write will be replicated to his many replicas - "DataDir": "prana-data", // The base directory for storing data - - // KafkaBrokers are the config for the Kafka brokers used by Prana - // - a map of broker name (a string) to the broker config - "KafkaBrokers": { - "testbroker": { - "ClientType": 2, // Client type determines which Kafka client library is used - "Properties": { // Properties get passed through to the client library - } - } - }, - - // Less likely you will want to change these settings - - "TestServer": false, // For a real server always set to false - "DataSnapshotEntries": 10000, // The number of main data writes before a snapshot is triggered - "DataCompactionOverhead": 2500, // After a snapshot is taken how many writes to retain for main data - "SequenceSnapshotEntries": 1000, // The number of sequence writes before a snapshot is triggered - "SequenceCompactionOverhead": 250, // After a snapshot is taken how many writes to retain for sequences - "LocksSnapshotEntries": 1000, // The number of lock writes before a snapshot is triggered - "LocksCompactionOverhead": 250, // After a snapshot is taken how many writes to retain for locks - "Debug": false, // Set to true to start a profiling server - "NotifierHeartbeatInterval": 30000000000, // Amount of time in nanoseconds between notifier heartbeats - "EnableAPIServer": true, // Set to true to enable the API server - needed for CLI access - "APIServerSessionTimeout": 30000000000, // The amount of time in nanoseconds before an API server session times out - "APIServerSessionCheckInterval": 5000000000 // The amount of time in nanoseconds between checking for expired API server sessions -} \ No newline at end of file +// NodeID is not specified in the config file, it is specified on the command line. This allows you to use +// the same config file for each node in the cluster + +cluster-id = 12345 // Each node in the same Prana cluster must have the same ClusterID, there can be multiple Prana clusters on your network + +// RaftAddresses are the addresses used by Dragonboat to form Raft clusters. They can be local to your network +raft-addresses = [ + "localhost:63201", + "localhost:63202", + "localhost:63203" +] + +// Each node of the cluster listens for notifications from other nodes - these are the addresses they listen at +notif-listen-addresses = [ + "localhost:63301", + "localhost:63302", + "localhost:63303" +] + +// These are the addresses the API server listens at on each node - these is used for connecting from clients +api-server-listen-addresses = [ + "localhost:6584", + "localhost:6585", + "localhost:6586" +] + +num-shards = 30 // Numshards is the total number of shards in the cluster +replication-factor = 3 // The number of replicas - each write will be replicated to his many replicas +data-dir = "prana-data" // The base directory for storing data + +// KafkaBrokers are the config for the Kafka brokers used by Prana +// - a map of broker name (a string) to the broker config +kafka-brokers = { + testbroker = { + client-type = 2, // Client type determines which Kafka client library is used + properties = { + // Properties get passed through to the client library + } + } +} + +// Less likely you will want to change these settings + +test-server = false // For a real server always set to false +data-snapshot-entries = 10000 // The number of main data writes before a snapshot is triggered +data-compaction-overhead = 2500 // After a snapshot is taken how many writes to retain for main data +sequence-snapshot-entries = 1000 // The number of sequence writes before a snapshot is triggered +sequence-compaction-overhead = 250 // After a snapshot is taken how many writes to retain for sequences +locks-snapshot-entries = 1000 // The number of lock writes before a snapshot is triggered +locks-compaction-overhead = 250 // After a snapshot is taken how many writes to retain for locks +debug = false // Set to true to start a profiling server +notifier-heartbeat-interval = "30s" // Amount of time in nanoseconds between notifier heartbeats +enable-api-server = true // Set to true to enable the API server - needed for CLI access +api-server-session-timeout = "30s" // The amount of time in nanoseconds before an API server session times out +api-server-session-check-interval = "5s" // The amount of time in nanoseconds between checking for expired API server sessions \ No newline at end of file diff --git a/cmd/pranadb/main.go b/cmd/pranadb/main.go index ff299447..9be4dd3e 100644 --- a/cmd/pranadb/main.go +++ b/cmd/pranadb/main.go @@ -20,7 +20,7 @@ type cli struct { func main() { r := &runner{} if err := r.run(os.Args[1:], true); err != nil { - log.Fatal(err.Error()) + log.WithError(err).Fatal("startup failed") } select {} // prevent main exiting }