Compare commits
3 Commits
developmen
...
bugfix/S3C
Author | SHA1 | Date |
---|---|---|
bbuchanan9 | 7907e3fe85 | |
bbuchanan9 | b9a5f7d855 | |
Jianqin Wang | 8ada986624 |
|
@ -92,6 +92,12 @@ class Config {
|
|||
'bad config: sentinel port must be a number');
|
||||
this.redis.sentinels.push({ host, port });
|
||||
});
|
||||
if (config.redis.sentinelPassword !== undefined) {
|
||||
assert(typeof config.redis.sentinelPassword === 'string',
|
||||
'bad config: redis.sentinelPassword must be a string');
|
||||
this.redis.sentinelPassword =
|
||||
config.redis.sentinelPassword;
|
||||
}
|
||||
} else {
|
||||
// check for standalone configuration
|
||||
assert(typeof config.redis.host === 'string',
|
||||
|
|
|
@ -22,6 +22,7 @@ class UtapiReindex {
|
|||
host: '127.0.0.1',
|
||||
port: 16379,
|
||||
name: 'scality-s3',
|
||||
sentinelPassword: '',
|
||||
};
|
||||
this._bucketd = {
|
||||
host: '127.0.0.1',
|
||||
|
@ -36,10 +37,12 @@ class UtapiReindex {
|
|||
this._schedule = config.schedule;
|
||||
}
|
||||
if (config && config.sentinel) {
|
||||
const { host, port, name } = config.sentinel;
|
||||
const { host, port, name, sentinelPassword } = config.sentinel;
|
||||
this._sentinel.host = host || this._sentinel.host;
|
||||
this._sentinel.port = port || this._sentinel.port;
|
||||
this._sentinel.name = name || this._sentinel.name;
|
||||
this._sentinel.sentinelPassword =
|
||||
sentinelPassword || this._sentinel.sentinelPassword;
|
||||
}
|
||||
if (config && config.bucketd) {
|
||||
const { host, port } = config.bucketd;
|
||||
|
@ -61,6 +64,7 @@ class UtapiReindex {
|
|||
port: this._sentinel.port,
|
||||
}],
|
||||
name: this._sentinel.name,
|
||||
sentinelPassword: this._sentinel.sentinelPassword,
|
||||
}, this._log);
|
||||
}
|
||||
|
||||
|
@ -78,6 +82,7 @@ class UtapiReindex {
|
|||
this._sentinel.host,
|
||||
this._sentinel.port,
|
||||
this._sentinel.name,
|
||||
this._sentinel.sentinelPassword,
|
||||
this._bucketd.host,
|
||||
this._bucketd.port,
|
||||
]);
|
||||
|
|
|
@ -10,12 +10,13 @@ import sys
|
|||
from threading import Thread
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
if len(sys.argv) == 6:
|
||||
if len(sys.argv) == 7:
|
||||
ip = sys.argv[1]
|
||||
port = sys.argv[2]
|
||||
sentinel_cluster_name = sys.argv[3]
|
||||
bucketd_host = sys.argv[4]
|
||||
bucketd_port = sys.argv[5]
|
||||
sentinel_password = sys.argv[4]
|
||||
bucketd_host = sys.argv[5]
|
||||
bucketd_port = sys.argv[6]
|
||||
print("Sentinel IP used: %s" % ip)
|
||||
print("Sentinel port used: %s" % port)
|
||||
print("Sentinel cluster name used: %s" % sentinel_cluster_name)
|
||||
|
@ -25,6 +26,7 @@ else:
|
|||
ip = "127.0.0.1"
|
||||
port = "16379"
|
||||
sentinel_cluster_name = "scality-s3"
|
||||
sentinel_password = ''
|
||||
bucketd_host = "127.0.0.1"
|
||||
bucketd_port = "9000"
|
||||
|
||||
|
@ -37,7 +39,7 @@ class askRedis():
|
|||
|
||||
def __init__(self, ip="127.0.0.1", port="16379", sentinel_cluster_name="scality-s3"):
|
||||
|
||||
r = redis.Redis(host=ip, port=port, db=0)
|
||||
r = redis.Redis(host=ip, port=port, db=0, password=sentinel_password)
|
||||
self._ip, self._port = r.sentinel_get_master_addr_by_name(sentinel_cluster_name)
|
||||
|
||||
def read(self, resource, name):
|
||||
|
|
|
@ -10,12 +10,13 @@ import sys
|
|||
from threading import Thread
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
if len(sys.argv) == 6:
|
||||
if len(sys.argv) == 7:
|
||||
ip = sys.argv[1]
|
||||
port = sys.argv[2]
|
||||
sentinel_cluster_name = sys.argv[3]
|
||||
bucketd_host = sys.argv[4]
|
||||
bucketd_port = sys.argv[5]
|
||||
sentinel_password = sys.argv[4]
|
||||
bucketd_host = sys.argv[5]
|
||||
bucketd_port = sys.argv[6]
|
||||
print("Sentinel IP used: %s" % ip)
|
||||
print("Sentinel port used: %s" % port)
|
||||
print("Sentinel cluster name used: %s" % sentinel_cluster_name)
|
||||
|
@ -25,6 +26,7 @@ else:
|
|||
ip = "127.0.0.1"
|
||||
port = "16379"
|
||||
sentinel_cluster_name = "scality-s3"
|
||||
sentinel_password = ''
|
||||
bucketd_host = "127.0.0.1"
|
||||
bucketd_port = "9000"
|
||||
|
||||
|
@ -37,7 +39,7 @@ class updateRedis():
|
|||
|
||||
def __init__(self, ip="127.0.0.1", port="16379", sentinel_cluster_name="scality-s3"):
|
||||
|
||||
r = redis.Redis(host=ip, port=port, db=0)
|
||||
r = redis.Redis(host=ip, port=port, db=0, password=sentinel_password)
|
||||
self._ip, self._port = r.sentinel_get_master_addr_by_name(sentinel_cluster_name)
|
||||
|
||||
def read(self, resource, name):
|
||||
|
|
|
@ -6,6 +6,7 @@ const Redis = require('ioredis');
|
|||
* @param {string} config.host - redis host
|
||||
* @param {number} config.port - redis port
|
||||
* @param {string} [config.password] - redis password (optional)
|
||||
* @param {string} [config.sentinelPassword] - sentinel password (optional)
|
||||
* @param {Werelogs.Logger} log - Werelogs logger
|
||||
* @return {Redis} - Redis client instance
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue