Foreman terminates immediately

一个人想着一个人 提交于 2019-12-03 13:53:15

问题


I recently installed OSX and Ubuntu on different computers. I then attempted to install redis and foreman for both OS's. Both errors threw no flags, and seemed to execute successfully. However, whenever I go to start foreman with foreman start, I run into the below issue on both computers:

23:48:35 web.1    | started with pid 1316
23:48:35 redis.1  | started with pid 1317
23:48:35 worker.1 | started with pid 1318
23:48:35 redis.1  | [1317] 11 Jun 23:48:35.180 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
23:48:35 redis.1  | [1317] 11 Jun 23:48:35.181 * Increased maximum number of open files to 10032 (it was originally set to 256).
23:48:35 redis.1  | [1317] 11 Jun 23:48:35.181 # Creating Server TCP listening socket *:6379: bind: Address already in use
23:48:35 redis.1  | exited with code 1
23:48:35 system   | sending SIGTERM to all processes
23:48:35 worker.1 | terminated by SIGTERM
23:48:35 web.1    | terminated by SIGTERM

For some reason, it seems like a path issue to me because it seems like Redis or Foreman cannot find the files they need to use to successfully execute, but I'm not exactly sure.

On OSX I used gem install foreman and Brew install Redis .

On Ubuntu I used the following:

Redis:

$ cd ~
$ wget http://download.redis.io/redis-stable.tar.gz
$ tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ make
$ make test 

Foreman:

$ gem install foreman

My PATH on OSX is as follows:

/Users/c/.rvm/gems/ruby-2.1.0/bin:/Users/c/.rvm/gems/ruby-2.1.0@global/bin:/Users/c/.rvm/rubies/ruby-2.1.0/bin:/Users/c/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

On Ubuntu, my PATH is:

/usr/local/bin:/usr/lib/postgresql:/usr/lib/postgresql/9.3:/usr/lib/ postgresql/9.3/lib:/usr/lib/postgresql/9.3/bin:/usr/share/doc:/usr/share/doc/postgresql-9.3:/usr/share/postgresql:/usr/share/postgresql/9.3:/usr/share/postgresql/9.3/man:$PATH

Redis-server does seem to execute successfully once, and then it fails with the message:

[1457] 12 Jun 00:02:48.481 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[1457] 12 Jun 00:02:48.482 * Increased maximum number of open files to 10032 (it was originally set to 256).
[1457] 12 Jun 00:02:48.483 # Creating Server TCP listening socket *:6379: bind: Address already in use

Trying $ redis-server stop returns:

[1504] 12 Jun 00:05:56.173 # Fatal error, can't open config file 'stop'

I need help figuring out how to get Foreman and Redis working together so that I can view my local files in the browser at 127.0.0.1

EDIT

Redis does start, but nothing happens when I navigate to localhost:6379. I also tried the suggestion of finding processes. It found

c                751   0.0  0.0  2432768    596 s005  R+    2:03PM   0:00.00 grep redis
c                616   0.0  0.0  2469952   1652 s004  S+    2:01PM   0:00.05 redis-server *:6379

Trying to kill the process results in

kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]


回答1:


Try starting Redis server with the following command :

redis-server <path to your config file>

Also, check if there's an instance of Redis server already running by

ps aux | grep redis 

and then if process is found :

kill <process id>

Restart your redis server.




回答2:


This one liner will kill any existing redis-servers and then start a new redis-server. When run in Foreman it doesn't send a SIGTERM which causes Foreman to quit, sending a SIGINT lets Foreman continue.

(ps aux | grep 6379 | grep redis | awk '{ print $2 }' | xargs kill -s SIGINT) && redis-server

In Procfile.dev:

redis: (ps aux | grep 6379 | grep redis | awk '{ print $2 }' | xargs kill -s SIGINT) && redis-server




回答3:


  1. List the redis server running using terminal command : ps aux | grep redis
  2. In list note down 'pid' number of the server which you want to terminate Example pid: 5379
  3. use command : kill 5379


来源:https://stackoverflow.com/questions/24177496/foreman-terminates-immediately

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!