Browse Source

Merge 0e16c4aaa6 into d7c30fdb2b

pull/7998/merge
Walnuts 1 day ago
committed by GitHub
parent
commit
ce9431e50b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      weed/command/scaffold/filer.toml
  2. 14
      weed/filer/cassandra2/cassandra_store.go

6
weed/command/scaffold/filer.toml

@ -186,6 +186,12 @@ hosts = [
]
username = ""
password = ""
# Set the CA certificate path
ssl_ca_path = ""
# Set the client certificate path
ssl_cert_path = ""
# Set the client private key path
ssl_key_path = ""
# This changes the data layout. Only add new directories. Removing/Updating will cause data loss.
superLargeDirectories = []
# Name of the datacenter local to this filer, used as host selection fallback.

14
weed/filer/cassandra2/cassandra_store.go

@ -34,6 +34,9 @@ func (store *Cassandra2Store) Initialize(configuration util.Configuration, prefi
configuration.GetStringSlice(prefix+"hosts"),
configuration.GetString(prefix+"username"),
configuration.GetString(prefix+"password"),
configuration.GetString(prefix+"ssl_ca_path"),
configuration.GetString(prefix+"ssl_cert_path"),
configuration.GetString(prefix+"ssl_key_path"),
configuration.GetStringSlice(prefix+"superLargeDirectories"),
configuration.GetString(prefix+"localDC"),
configuration.GetInt(prefix+"connection_timeout_millisecond"),
@ -45,11 +48,20 @@ func (store *Cassandra2Store) isSuperLargeDirectory(dir string) (dirHash string,
return
}
func (store *Cassandra2Store) initialize(keyspace string, hosts []string, username string, password string, superLargeDirectories []string, localDC string, timeout int) (err error) {
func (store *Cassandra2Store) initialize(keyspace string, hosts []string, username string, password string, sslCaPath string, sslCertPath string, sslKeyPath string, superLargeDirectories []string, localDC string, timeout int) (err error) {
store.cluster = gocql.NewCluster(hosts...)
if username != "" && password != "" {
store.cluster.Authenticator = gocql.PasswordAuthenticator{Username: username, Password: password}
}
if sslCaPath != "" || sslCertPath != "" || sslKeyPath != "" {
store.cluster.SslOpts = &gocql.SslOptions{
CaPath: sslCaPath,
CertPath: sslCertPath,
KeyPath: sslKeyPath,
EnableHostVerification: true,
}
store.cluster.Port = 9142
}
store.cluster.Keyspace = keyspace
store.cluster.Timeout = time.Duration(timeout) * time.Millisecond
glog.V(0).Infof("timeout = %d", timeout)

Loading…
Cancel
Save