Authored by 李奇

修改redis配置、区分缓存和session

... ... @@ -145,7 +145,6 @@ module.exports = {
apiCache: {
cache: true
},
sessionRedisPrefix: 'yohobuy_session:',
zookeeperServer: '192.168.102.168:2188',
redis: {
connect: {
... ... @@ -164,6 +163,11 @@ module.exports = {
}
return Math.min(options.attempt * 100, 1000);
}
},
session: {
host: '192.168.102.49',
port: '6379',
prefix: 'yohobuy_session:'
}
},
REQUEST_LIMIT: {
... ... @@ -206,21 +210,27 @@ if (isProduction) {
zookeeperServer: 'web.zookeeper.yohoops.org:2181',
redis: {
connect: {
host: 'web.redis.yohoops.org'
},
port: '6379',
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('redis连接不成功');
}
if (options.total_retry_time > 1000 * 60 * 60 * 6) {
console.log('redis连接超时');
return;
}
if (options.attempt > 10) {
return 1000 * 60 * 60 * 0.5;
host: 'web.redis.yohoops.org',
port: '6379',
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('redis连接不成功');
}
if (options.total_retry_time > 1000 * 60 * 60 * 6) {
console.log('redis连接超时');
return;
}
if (options.attempt > 10) {
return 1000 * 60 * 60 * 0.5;
}
return Math.min(options.attempt * 100, 1000);
}
return Math.min(options.attempt * 100, 1000);
},
session: {
host: 'redis.web.yohoops.org',
port: '6379',
pass: 'redis9646',
prefix: 'yohobuy_session:'
}
},
report: {
... ... @@ -244,25 +254,6 @@ if (isProduction) {
yohoNowApi: process.env.YOHO_NOW_API || 'http://yohonow-test.yohops.com:9999/',
},
useOneapm: true,
useCache: true,
redis: {
connect: {
host: '192.168.104.32',
port: '6379',
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
// console.log('redis连接不成功');
}
if (options.total_retry_time > 1000 * 60 * 60 * 6) {
// console.log('redis连接超时');
return;
}
if (options.attempt > 10) {
return 1000 * 60 * 60 * 0.5;
}
return Math.min(options.attempt * 100, 1000);
}
}
}
useCache: true
});
}
... ...
... ... @@ -63,11 +63,7 @@ module.exports = (app) => {
getid() {
return uuid.v4();
},
store: new RedisStore({
port: config.redis.port,
host: config.redis.connect.host,
prefix: config.sessionRedisPrefix
})
store: new RedisStore(config.redis.session)
}));
app.use(cookieSession({ // eslint-disable-line
... ...
... ... @@ -57,7 +57,7 @@
"urlencode": "^1.1.0",
"uuid": "^2.0.2",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "=0.6.5",
"yoho-node-lib": "=0.6.6",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
... ...
... ... @@ -8670,9 +8670,9 @@ yoho-jquery@^1.12.4:
version "1.12.4"
resolved "http://npm.yohops.com/yoho-jquery/-/yoho-jquery-1.12.4.tgz#22499b325f293ee8b1d60559777348156494926d"
yoho-node-lib@=0.6.5:
version "0.6.5"
resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.5.tgz#ec9a4fefb03a1453316c085507595dbf2d50ebcc"
yoho-node-lib@=0.6.6:
version "0.6.6"
resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.6.tgz#2c727bed970d8829730ac077bd379aa506db16f3"
dependencies:
dnscache "^1.0.1"
handlebars "^4.0.5"
... ...