diff --git a/go/filer/redis_store/redis_store.go b/go/filer/redis_store/redis_store.go index e71776845..939172557 100644 --- a/go/filer/redis_store/redis_store.go +++ b/go/filer/redis_store/redis_store.go @@ -8,10 +8,10 @@ type RedisStore struct { Client *redis.Client } -func NewRedisStore(hostPort string, database int) *RedisStore { +func NewRedisStore(hostPort string, password string, database int) *RedisStore { client := redis.NewTCPClient(&redis.Options{ Addr: hostPort, - Password: "", // no password set + Password: password, DB: int64(database), }) return &RedisStore{Client: client} diff --git a/go/weed/filer.go b/go/weed/filer.go index 84a37c3c1..ae9dac2ca 100644 --- a/go/weed/filer.go +++ b/go/weed/filer.go @@ -27,6 +27,7 @@ type FilerOptions struct { cassandra_server *string cassandra_keyspace *string redis_server *string + redis_password *string redis_database *int } @@ -42,6 +43,7 @@ func init() { f.cassandra_server = cmdFiler.Flag.String("cassandra.server", "", "host[:port] of the cassandra server") f.cassandra_keyspace = cmdFiler.Flag.String("cassandra.keyspace", "seaweed", "keyspace of the cassandra server") f.redis_server = cmdFiler.Flag.String("redis.server", "", "host:port of the redis server, e.g., 127.0.0.1:6379") + f.redis_password = cmdFiler.Flag.String("redis.password", "", "password in clear text") f.redis_database = cmdFiler.Flag.Int("redis.database", 0, "the database on the redis server") f.secretKey = cmdFiler.Flag.String("secure.secret", "", "secret to encrypt Json Web Token(JWT)") @@ -80,7 +82,7 @@ func runFiler(cmd *Command, args []string) bool { *f.defaultReplicaPlacement, *f.redirectOnRead, *f.disableDirListing, *f.secretKey, *f.cassandra_server, *f.cassandra_keyspace, - *f.redis_server, *f.redis_database, + *f.redis_server, *f.redis_password, *f.redis_database, ) if nfs_err != nil { glog.Fatalf("Filer startup error: %v", nfs_err) diff --git a/go/weed/server.go b/go/weed/server.go index 22aae9e13..6b5fcf9e4 100644 --- a/go/weed/server.go +++ b/go/weed/server.go @@ -89,6 +89,7 @@ func init() { filerOptions.cassandra_server = cmdServer.Flag.String("filer.cassandra.server", "", "host[:port] of the cassandra server") filerOptions.cassandra_keyspace = cmdServer.Flag.String("filer.cassandra.keyspace", "seaweed", "keyspace of the cassandra server") filerOptions.redis_server = cmdServer.Flag.String("filer.redis.server", "", "host:port of the redis server, e.g., 127.0.0.1:6379") + filerOptions.redis_password = cmdServer.Flag.String("filer.redis.password", "", "redis password in clear text") filerOptions.redis_database = cmdServer.Flag.Int("filer.redis.database", 0, "the database on the redis server") } @@ -169,7 +170,7 @@ func runServer(cmd *Command, args []string) bool { *filerOptions.redirectOnRead, *filerOptions.disableDirListing, *filerOptions.secretKey, *filerOptions.cassandra_server, *filerOptions.cassandra_keyspace, - *filerOptions.redis_server, *filerOptions.redis_database, + *filerOptions.redis_server, *filerOptions.redis_password, *filerOptions.redis_database, ) if nfs_err != nil { glog.Fatalf("Filer startup error: %v", nfs_err) diff --git a/go/weed/weed_server/filer_server.go b/go/weed/weed_server/filer_server.go index 616f11022..ae3088454 100644 --- a/go/weed/weed_server/filer_server.go +++ b/go/weed/weed_server/filer_server.go @@ -28,7 +28,7 @@ func NewFilerServer(r *http.ServeMux, port int, master string, dir string, colle replication string, redirectOnRead bool, disableDirListing bool, secret string, cassandra_server string, cassandra_keyspace string, - redis_server string, redis_database int, + redis_server string, redis_password string, redis_database int, ) (fs *FilerServer, err error) { fs = &FilerServer{ master: master, @@ -46,7 +46,7 @@ func NewFilerServer(r *http.ServeMux, port int, master string, dir string, colle } fs.filer = flat_namespace.NewFlatNamespaceFiler(master, cassandra_store) } else if redis_server != "" { - redis_store := redis_store.NewRedisStore(redis_server, redis_database) + redis_store := redis_store.NewRedisStore(redis_server, redis_password, redis_database) fs.filer = flat_namespace.NewFlatNamespaceFiler(master, redis_store) } else { if fs.filer, err = embedded_filer.NewFilerEmbedded(master, dir); err != nil {