keenwon / antcolony

Nodejs实现的一个磁力链接爬虫 https://findit.keenwon.com (原域名http://findit.so )

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redis 的部署教程问题

talway opened this issue · comments

我也是按找教程来的安装,但还是pm2 还是错误;
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'

http://keenwon.com/1335.html中

6、添加启动脚本,执行:

路径exexce错误了吧
默认安装是/usr/src/redis-2.8.13/ 吧

redis.log是正确的,但就是连接不上

[1691] 20 Apr 12:44:01.114 * Increased maximum number of open files to 10032 (it was originally set to 1024).
[1691] 20 Apr 12:44:01.115 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
.
.-__ ''-._ _.- .. ''-._ Redis 2.8.13 (00000000/0) 32 bit
.-.-``.``\/ _.,_ ''-._ ( ' , .- | , ) Running in stand alone mode |-.-...- __...-.-._|'.-'| Port: 6379
|-._ ._ / .-' | PID: 1691
-._ -.
-./ _.-' _.-' |-.-._-.**.-' .-'.-'|
| -._-.
.-'.-' | http://redis.io
-._-.-.**.-'_.-' _.-' |-.-._-.**.-' .-'.-'|
| -._-._ .-'.-' |
-._-.-.**.-'_.-' _.-' -. -.__.-' _.-' -._ _.-'
`-.__.-'

[1691] 20 Apr 12:44:01.116 # Server started, Redis version 2.8.13
[1691] 20 Apr 12:44:01.116 * The server is now ready to accept connections on port 6379
1691 | signal handler Received SIGTERM, scheduling shutdown...
[1691] 20 Apr 12:46:18.963 # User requested shutdown...
[1691] 20 Apr 12:46:18.963 * Saving the final RDB snapshot before exiting.
[1691] 20 Apr 12:46:18.964 * DB saved on disk
[1691] 20 Apr 12:46:18.964 * Removing the pid file.
[1691] 20 Apr 12:46:18.964 # Redis is now ready to exit, bye bye...

你redis是后台运行的吗?日志显示马上就退出了

redis安装路径的问题,你自己看下/usr/local/bin/目录

路径 我看了 是有的,已改了,目前是完全安装你的教程安装;
执行 /etc/init.d/redis start 出现如下提示
[root@vultr dist]# /etc/init.d/redis start
/etc/init.d/redis: line 1: tartup: command not found
/etc/init.d/redis: line 52: syntax error near unexpected token ;' /etc/init.d/redis: line 52: echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2'

[1458] 20 Apr 13:46:49.746 # Server started, Redis version 2.8.13
[1458] 20 Apr 13:46:49.746 * The server is now ready to accept connections on port 6379
1458 | signal handler Received SIGTERM, scheduling shutdown...
[1458] 20 Apr 13:48:19.975 # User requested shutdown...
[1458] 20 Apr 13:48:19.975 * Saving the final RDB snapshot before exiting.
[1458] 20 Apr 13:48:19.977 * DB saved on disk
[1458] 20 Apr 13:48:19.977 * Removing the pid file.
[1458] 20 Apr 13:48:19.977 # Redis is now ready to exit, bye bye...
[1210] 20 Apr 13:48:48.773 * Increased maximum number of open files to 10032 (it was originally set to 1024).
[1210] 20 Apr 13:48:48.774 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
.
.-__ ''-._ _.- .. ''-._ Redis 2.8.13 (00000000/0) 32 bit
.-.-``.``\/ _.,_ ''-._ ( ' , .- | , ) Running in stand alone mode |-.-...- __...-.-._|'.-'| Port: 6379
|-._ ._ / .-' | PID: 1210
-._ -.
-./ _.-' _.-' |-.-._-.**.-' .-'.-'|
| -._-.
.-'.-' | http://redis.io
-._-.-.**.-'_.-' _.-' |-.-._-.**.-' .-'.-'|
| -._-._ .-'.-' |
-._-.-.**.-'_.-' _.-' -. -.__.-' _.-' -._ _.-'
`-.__.-'

[1210] 20 Apr 13:48:48.775 # Server started, Redis version 2.8.13
[1210] 20 Apr 13:48:48.775 * The server is now ready to accept connections on port 6379
[1210] 20 Apr 13:51:25.501 * 10000 changes in 60 seconds. Saving...
[1210] 20 Apr 13:51:25.502 * Background saving started by pid 1277
[1277] 20 Apr 13:51:25.514 * DB saved on disk
[1277] 20 Apr 13:51:25.515 * RDB: 0 MB of memory used by copy-on-write
[1210] 20 Apr 13:51:25.603 * Background saving terminated with success
[1210] 20 Apr 13:52:26.099 * 10000 changes in 60 seconds. Saving...
[1210] 20 Apr 13:52:26.100 * Background saving started by pid 1299
[1299] 20 Apr 13:52:26.126 * DB saved on disk
[1299] 20 Apr 13:52:26.126 * RDB: 0 MB of memory used by copy-on-write
[1210] 20 Apr 13:52:26.200 * Background saving terminated with success
[1210] 20 Apr 13:53:27.011 * 10000 changes in 60 seconds. Saving...
[1210] 20 Apr 13:53:27.013 * Background saving started by pid 1300
[1300] 20 Apr 13:53:27.052 * DB saved on disk
[1300] 20 Apr 13:53:27.053 * RDB: 0 MB of memory used by copy-on-write
[1210] 20 Apr 13:53:27.113 * Background saving terminated with success
[1210] 20 Apr 13:54:28.043 * 10000 changes in 60 seconds. Saving...
[1210] 20 Apr 13:54:28.044 * Background saving started by pid 1306
[1306] 20 Apr 13:54:28.108 * DB saved on disk
[1306] 20 Apr 13:54:28.109 * RDB: 0 MB of memory used by copy-on-write
[1210] 20 Apr 13:54:28.145 * Background saving terminated with success

但执行 还是出错:

[root@vultr dist]# pm2 logs
########### Starting streaming logs for [all] process
[worker[3000]-0 (out)] nect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3000]-0 (out)]
[worker[3000]-0 (out)] ##############################################################
[worker[3000]-0 (out)] #
[worker[3000]-0 (out)] # !!! MONGOOSE WARNING !!!
[worker[3000]-0 (out)] #
[worker[3000]-0 (out)] # This is an UNSTABLE release of Mongoose.
[worker[3000]-0 (out)] # Unstable releases are available for preview/testing only.
[worker[3000]-0 (out)] # DO NOT run this in production.
[worker[3000]-0 (out)] #
[worker[3000]-0 (out)] ##############################################################
[worker[3000]-0 (out)]
[worker[3000]-0 (out)] Warning: Redis server does not require a password, but a password was supplied.
[worker[3001]-1 (out)] nect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[worker[3001]-1 (out)]
[worker[3001]-1 (out)] ##############################################################
[worker[3001]-1 (out)] #
[worker[3001]-1 (out)] # !!! MONGOOSE WARNING !!!
[worker[3001]-1 (out)] #
[worker[3001]-1 (out)] # This is an UNSTABLE release of Mongoose.
[worker[3001]-1 (out)] # Unstable releases are available for preview/testing only.
[worker[3001]-1 (out)] # DO NOT run this in production.
[worker[3001]-1 (out)] #
[worker[3001]-1 (out)] ##############################################################
[worker[3001]-1 (out)]
[worker[3001]-1 (out)] Warning: Redis server does not require a password, but a password was supplied.
[male[1]-2 (out)] nect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[male[1]-2 (out)]
[male[1]-2 (out)] ##############################################################
[male[1]-2 (out)] #
[male[1]-2 (out)] # !!! MONGOOSE WARNING !!!
[male[1]-2 (out)] #
[male[1]-2 (out)] # This is an UNSTABLE release of Mongoose.
[male[1]-2 (out)] # Unstable releases are available for preview/testing only.
[male[1]-2 (out)] # DO NOT run this in production.
[male[1]-2 (out)] #
[male[1]-2 (out)] ##############################################################
[male[1]-2 (out)]
[male[1]-2 (out)] Warning: Redis server does not require a password, but a password was supplied.
[female[1]-3 (out)] nect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)] 'redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED'
[female[1]-3 (out)]
[female[1]-3 (out)] ##############################################################
[female[1]-3 (out)] #
[female[1]-3 (out)] # !!! MONGOOSE WARNING !!!
[female[1]-3 (out)] #
[female[1]-3 (out)] # This is an UNSTABLE release of Mongoose.
[female[1]-3 (out)] # Unstable releases are available for preview/testing only.
[female[1]-3 (out)] # DO NOT run this in production.
[female[1]-3 (out)] #
[female[1]-3 (out)] ##############################################################
[female[1]-3 (out)]
[female[1]-3 (out)] Warning: Redis server does not require a password, but a password was supplied.

1、你要确定redis没被退出,执行redis-cli看看能不能连上
2、确定ip和端口号是否正确
3、pm2 flush清空日志,pm2 restart all重启AntColony,redis.log也清除下。

然后再看看有没有问题

1、
[root@vultr ~]# redis-cli
127.0.0.1:6379> quit
[root@vultr ~]#

2、
配置文件
// redis相关
redisHost: '127.0.0.1', // 服务器
//redisHost: '127.0.0.1',
redisPort: 6379,
redisAuth: '123456',
3、
[root@vultr ~]# pm2 flush
[PM2] Flushing /root/.pm2/pm2.log
[PM2] Flushing
[PM2] /root/.pm2/logs/worker-3000--out-0.log
[PM2] /root/.pm2/logs/worker-3000--err-0.log
[PM2] Flushing
[PM2] /root/.pm2/logs/worker-3001--out-1.log
[PM2] /root/.pm2/logs/worker-3001--err-1.log
[PM2] Flushing
[PM2] /root/.pm2/logs/male-1--out-2.log
[PM2] /root/.pm2/logs/male-1--err-2.log
[PM2] Flushing
[PM2] /root/.pm2/logs/female-1--out-3.log
[PM2] /root/.pm2/logs/female-1--err-3.log

[PM2] Logs flushed

[root@vultr ~]# pm2 restart all
[PM2] Process worker[3000] restarted
[PM2] Process worker[3001] restarted
[PM2] Process male[1] restarted
[PM2] Process female[1] restarted
[PM2] All processes has been restarted
┌───────────────────────────────────┬────┬──────┬──────┬────────┬───────────┬────────┬─────────────┬─────────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │ watching │
├───────────────────────────────────┼────┼──────┼──────┼────────┼───────────┼────────┼─────────────┼─────────────┤
│ function bold() { [native code] } │ 0 │ fork │ 1354 │ online │ 1 │ 1s │ 24.785 MB │ unactivated │
│ function bold() { [native code] } │ 1 │ fork │ 1356 │ online │ 1 │ 1s │ 24.055 MB │ unactivated │
│ function bold() { [native code] } │ 2 │ fork │ 1358 │ online │ 1 │ 1s │ 22.973 MB │ unactivated │
│ function bold() { [native code] } │ 3 │ fork │ 1360 │ online │ 1 │ 1s │ 22.949 MB │ unactivated │
└───────────────────────────────────┴────┴──────┴──────┴────────┴───────────┴────────┴─────────────┴─────────────┘
Use pm2 desc[ribe] <id> to get more details

执行log
[root@vultr ~]# pm2 logs
########### Starting streaming logs for [all] process
[worker[3000]-0 (out)]
[worker[3000]-0 (out)] ##############################################################
[worker[3000]-0 (out)] #
[worker[3000]-0 (out)] # !!! MONGOOSE WARNING !!!
[worker[3000]-0 (out)] #
[worker[3000]-0 (out)] # This is an UNSTABLE release of Mongoose.
[worker[3000]-0 (out)] # Unstable releases are available for preview/testing only.
[worker[3000]-0 (out)] # DO NOT run this in production.
[worker[3000]-0 (out)] #
[worker[3000]-0 (out)] ##############################################################
[worker[3000]-0 (out)]
[worker[3000]-0 (out)] Warning: Redis server does not require a password, but a password was supplied.
[worker[3001]-1 (out)]
[worker[3001]-1 (out)] ##############################################################
[worker[3001]-1 (out)] #
[worker[3001]-1 (out)] # !!! MONGOOSE WARNING !!!
[worker[3001]-1 (out)] #
[worker[3001]-1 (out)] # This is an UNSTABLE release of Mongoose.
[worker[3001]-1 (out)] # Unstable releases are available for preview/testing only.
[worker[3001]-1 (out)] # DO NOT run this in production.
[worker[3001]-1 (out)] #
[worker[3001]-1 (out)] ##############################################################
[worker[3001]-1 (out)]
[worker[3001]-1 (out)] Warning: Redis server does not require a password, but a password was supplied.
[male[1]-2 (out)]
[male[1]-2 (out)] ##############################################################
[male[1]-2 (out)] #
[male[1]-2 (out)] # !!! MONGOOSE WARNING !!!
[male[1]-2 (out)] #
[male[1]-2 (out)] # This is an UNSTABLE release of Mongoose.
[male[1]-2 (out)] # Unstable releases are available for preview/testing only.
[male[1]-2 (out)] # DO NOT run this in production.
[male[1]-2 (out)] #
[male[1]-2 (out)] ##############################################################
[male[1]-2 (out)]
[male[1]-2 (out)] Warning: Redis server does not require a password, but a password was supplied.
[female[1]-3 (out)]
[female[1]-3 (out)] ##############################################################
[female[1]-3 (out)] #
[female[1]-3 (out)] # !!! MONGOOSE WARNING !!!
[female[1]-3 (out)] #
[female[1]-3 (out)] # This is an UNSTABLE release of Mongoose.
[female[1]-3 (out)] # Unstable releases are available for preview/testing only.
[female[1]-3 (out)] # DO NOT run this in production.
[female[1]-3 (out)] #
[female[1]-3 (out)] ##############################################################
[female[1]-3 (out)]
[female[1]-3 (out)] Warning: Redis server does not require a password, but a password was supplied.

看样子是连接上了啊?

pm2 logs 是错误提示吗

pm2 logs是pm2记录的日志,pm2的api看这个

commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.