mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-06 08:27:04 +08:00
Removed --in-memory config flag. InMemory is now inferred from whether the data directory was provided.
This commit is contained in:
@@ -27,7 +27,6 @@ CMD "./server" \
|
|||||||
"--eviction-interval" "${EVICTION_INTERVAL}" \
|
"--eviction-interval" "${EVICTION_INTERVAL}" \
|
||||||
"--tls=${TLS}" \
|
"--tls=${TLS}" \
|
||||||
"--mtls=${MTLS}" \
|
"--mtls=${MTLS}" \
|
||||||
"--in-memory=${IN_MEMORY}" \
|
|
||||||
"--bootstrap-cluster=${BOOTSTRAP_CLUSTER}" \
|
"--bootstrap-cluster=${BOOTSTRAP_CLUSTER}" \
|
||||||
"--acl-config=${ACL_CONFIG}" \
|
"--acl-config=${ACL_CONFIG}" \
|
||||||
"--require-pass=${REQUIRE_PASS}" \
|
"--require-pass=${REQUIRE_PASS}" \
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,6 @@ services:
|
|||||||
- SERVER_ID=1
|
- SERVER_ID=1
|
||||||
- PLUGIN_DIR=/usr/local/lib/echovault
|
- PLUGIN_DIR=/usr/local/lib/echovault
|
||||||
- DATA_DIR=/var/lib/echovault
|
- DATA_DIR=/var/lib/echovault
|
||||||
- IN_MEMORY=false
|
|
||||||
- TLS=false
|
- TLS=false
|
||||||
- MTLS=false
|
- MTLS=false
|
||||||
- BOOTSTRAP_CLUSTER=false
|
- BOOTSTRAP_CLUSTER=false
|
||||||
@@ -65,7 +64,6 @@ services:
|
|||||||
- SERVER_ID=1
|
- SERVER_ID=1
|
||||||
- JOIN_ADDR=2/cluster_node_2:7946
|
- JOIN_ADDR=2/cluster_node_2:7946
|
||||||
- DATA_DIR=/var/lib/echovault
|
- DATA_DIR=/var/lib/echovault
|
||||||
- IN_MEMORY=true
|
|
||||||
- TLS=false
|
- TLS=false
|
||||||
- MTLS=false
|
- MTLS=false
|
||||||
- BOOTSTRAP_CLUSTER=true
|
- BOOTSTRAP_CLUSTER=true
|
||||||
@@ -112,7 +110,6 @@ services:
|
|||||||
- SERVER_ID=2
|
- SERVER_ID=2
|
||||||
- JOIN_ADDR=3/cluster_node_3:7946
|
- JOIN_ADDR=3/cluster_node_3:7946
|
||||||
- DATA_DIR=/var/lib/echovault
|
- DATA_DIR=/var/lib/echovault
|
||||||
- IN_MEMORY=true
|
|
||||||
- TLS=false
|
- TLS=false
|
||||||
- MTLS=false
|
- MTLS=false
|
||||||
- BOOTSTRAP_CLUSTER=false
|
- BOOTSTRAP_CLUSTER=false
|
||||||
@@ -159,7 +156,6 @@ services:
|
|||||||
- SERVER_ID=3
|
- SERVER_ID=3
|
||||||
- JOIN_ADDR=4/cluster_node_4:7946
|
- JOIN_ADDR=4/cluster_node_4:7946
|
||||||
- DATA_DIR=/var/lib/echovault
|
- DATA_DIR=/var/lib/echovault
|
||||||
- IN_MEMORY=true
|
|
||||||
- TLS=false
|
- TLS=false
|
||||||
- MTLS=false
|
- MTLS=false
|
||||||
- BOOTSTRAP_CLUSTER=false
|
- BOOTSTRAP_CLUSTER=false
|
||||||
@@ -206,7 +202,6 @@ services:
|
|||||||
- SERVER_ID=4
|
- SERVER_ID=4
|
||||||
- JOIN_ADDR=5/cluster_node_5:7946
|
- JOIN_ADDR=5/cluster_node_5:7946
|
||||||
- DATA_DIR=/var/lib/echovault
|
- DATA_DIR=/var/lib/echovault
|
||||||
- IN_MEMORY=true
|
|
||||||
- TLS=false
|
- TLS=false
|
||||||
- MTLS=false
|
- MTLS=false
|
||||||
- BOOTSTRAP_CLUSTER=false
|
- BOOTSTRAP_CLUSTER=false
|
||||||
@@ -253,7 +248,6 @@ services:
|
|||||||
- SERVER_ID=5
|
- SERVER_ID=5
|
||||||
- JOIN_ADDR=1/cluster_node_1:7946
|
- JOIN_ADDR=1/cluster_node_1:7946
|
||||||
- DATA_DIR=/var/lib/echovault
|
- DATA_DIR=/var/lib/echovault
|
||||||
- IN_MEMORY=true
|
|
||||||
- TLS=false
|
- TLS=false
|
||||||
- MTLS=false
|
- MTLS=false
|
||||||
- BOOTSTRAP_CLUSTER=false
|
- BOOTSTRAP_CLUSTER=false
|
||||||
|
@@ -86,7 +86,6 @@ func setupServer(
|
|||||||
conf.BindAddr = bindAddr
|
conf.BindAddr = bindAddr
|
||||||
conf.JoinAddr = joinAddr
|
conf.JoinAddr = joinAddr
|
||||||
conf.Port = uint16(port)
|
conf.Port = uint16(port)
|
||||||
conf.InMemory = true
|
|
||||||
conf.ServerID = serverId
|
conf.ServerID = serverId
|
||||||
conf.RaftBindPort = uint16(raftPort)
|
conf.RaftBindPort = uint16(raftPort)
|
||||||
conf.MemberListBindPort = uint16(mlPort)
|
conf.MemberListBindPort = uint16(mlPort)
|
||||||
|
@@ -42,7 +42,6 @@ type Config struct {
|
|||||||
BindAddr string `json:"BindAddr" yaml:"BindAddr"`
|
BindAddr string `json:"BindAddr" yaml:"BindAddr"`
|
||||||
RaftBindPort uint16 `json:"RaftPort" yaml:"RaftPort"`
|
RaftBindPort uint16 `json:"RaftPort" yaml:"RaftPort"`
|
||||||
MemberListBindPort uint16 `json:"MlPort" yaml:"MlPort"`
|
MemberListBindPort uint16 `json:"MlPort" yaml:"MlPort"`
|
||||||
InMemory bool `json:"InMemory" yaml:"InMemory"`
|
|
||||||
DataDir string `json:"DataDir" yaml:"DataDir"`
|
DataDir string `json:"DataDir" yaml:"DataDir"`
|
||||||
BootstrapCluster bool `json:"BootstrapCluster" yaml:"BootstrapCluster"`
|
BootstrapCluster bool `json:"BootstrapCluster" yaml:"BootstrapCluster"`
|
||||||
AclConfig string `json:"AclConfig" yaml:"AclConfig"`
|
AclConfig string `json:"AclConfig" yaml:"AclConfig"`
|
||||||
@@ -152,8 +151,7 @@ There is no limit by default.`, func(memory string) error {
|
|||||||
bindAddr := flag.String("bind-addr", "", "Address to bind the echovault to.")
|
bindAddr := flag.String("bind-addr", "", "Address to bind the echovault to.")
|
||||||
raftBindPort := flag.Uint("raft-port", 7481, "Port to use for intra-cluster communication. Leave on the client.")
|
raftBindPort := flag.Uint("raft-port", 7481, "Port to use for intra-cluster communication. Leave on the client.")
|
||||||
mlBindPort := flag.Uint("memberlist-port", 7946, "Port to use for memberlist communication.")
|
mlBindPort := flag.Uint("memberlist-port", 7946, "Port to use for memberlist communication.")
|
||||||
inMemory := flag.Bool("in-memory", false, "Whether to use memory or persistent storage for raft logs and snapshots.")
|
dataDir := flag.String("data-dir", ".", "Directory to store snapshots and logs.")
|
||||||
dataDir := flag.String("data-dir", "/var/lib/echovault", "Directory to store snapshots and logs.")
|
|
||||||
bootstrapCluster := flag.Bool("bootstrap-cluster", false, "Whether this instance should bootstrap a new cluster.")
|
bootstrapCluster := flag.Bool("bootstrap-cluster", false, "Whether this instance should bootstrap a new cluster.")
|
||||||
aclConfig := flag.String("acl-config", "", "ACL config file path.")
|
aclConfig := flag.String("acl-config", "", "ACL config file path.")
|
||||||
snapshotThreshold := flag.Uint64("snapshot-threshold", 1000, "The number of entries that trigger a snapshot. Default is 1000.")
|
snapshotThreshold := flag.Uint64("snapshot-threshold", 1000, "The number of entries that trigger a snapshot. Default is 1000.")
|
||||||
@@ -197,7 +195,6 @@ It is a plain text value by default but you can provide a SHA256 hash by adding
|
|||||||
BindAddr: *bindAddr,
|
BindAddr: *bindAddr,
|
||||||
RaftBindPort: uint16(*raftBindPort),
|
RaftBindPort: uint16(*raftBindPort),
|
||||||
MemberListBindPort: uint16(*mlBindPort),
|
MemberListBindPort: uint16(*mlBindPort),
|
||||||
InMemory: *inMemory,
|
|
||||||
DataDir: *dataDir,
|
DataDir: *dataDir,
|
||||||
BootstrapCluster: *bootstrapCluster,
|
BootstrapCluster: *bootstrapCluster,
|
||||||
AclConfig: *aclConfig,
|
AclConfig: *aclConfig,
|
||||||
|
@@ -17,7 +17,6 @@ func DefaultConfig() Config {
|
|||||||
BindAddr: "localhost",
|
BindAddr: "localhost",
|
||||||
RaftBindPort: 7481,
|
RaftBindPort: 7481,
|
||||||
MemberListBindPort: 7946,
|
MemberListBindPort: 7946,
|
||||||
InMemory: false,
|
|
||||||
DataDir: ".",
|
DataDir: ".",
|
||||||
BootstrapCluster: false,
|
BootstrapCluster: false,
|
||||||
AclConfig: "",
|
AclConfig: "",
|
||||||
|
@@ -67,7 +67,8 @@ func (r *Raft) RaftInit(ctx context.Context) {
|
|||||||
var stableStore raft.StableStore
|
var stableStore raft.StableStore
|
||||||
var snapshotStore raft.SnapshotStore
|
var snapshotStore raft.SnapshotStore
|
||||||
|
|
||||||
if conf.InMemory {
|
if conf.DataDir == "" {
|
||||||
|
// No data directory provided, use in memory stores.
|
||||||
logStore = raft.NewInmemStore()
|
logStore = raft.NewInmemStore()
|
||||||
stableStore = raft.NewInmemStore()
|
stableStore = raft.NewInmemStore()
|
||||||
snapshotStore = raft.NewInmemSnapshotStore()
|
snapshotStore = raft.NewInmemSnapshotStore()
|
||||||
|
Reference in New Issue
Block a user