如何在生产模式下运行 Redis 服务器和 Juggernaut 服务器

发布于 2024-12-04 18:06:22 字数 4388 浏览 0 评论 0原文

我正在使用 juggernaut 推送服务器。如何在生产模式下启动 redis 和 juggernaut,因为我

 juggernaut

redis-server will keep on showing me log etc.

我正在使用 ruby​​ on Rails 3。

编辑

我按照这两个指南进行设置 主宰生产服务器上的 redis

终端命令。

看来两台服务器现在都运行顺利。但是我如何访问

     :8080/application.js for juggernaut. 

我尝试过的

   my_ip:8080/application.js but nothing. 

托管我正在使用Linode。

EDIT2

当我尝试停止/启动 Redis 服务器时,它会给我输出,即:

  Starting/Stopping redis-server: redis-server.

但是当我为剑圣做同样的事情时,什么也没有。检查截图。

在此处输入图像描述

编辑

我看不到任何关于剑圣的日志..有一个对于redis,但对主宰没有任何作用

在此处输入图像描述

编辑

  1. 可执行文件权限/etc/init.d/juggernaut 文件 -- 是

     -rwxr-xr-x 1 fizzy fizzy 1310 九月 19 日 11:06 主宰
    
  2. PIDFILE=/var/run/juggernaut.pid' 已定义。那存在吗? --- 没有

  3. 在“开始”部分,它运行“chown juggernaut:juggernaut”。用户主宰是否存在并且它是组主宰的成员吗? -- 是/是

    <前><代码> cat /etc/group 雷迪斯:x:1002: 主宰:x:113: 团体主宰 主宰:主宰

编辑

     fizzy@li136-198:~$ sudo ls -l /usr/bin/juggernaut 
              ls: cannot access /usr/bin/juggernaut: No such file or directory
     fizzy@li136-198:~$ sudo ls -l /usr/local/bin/juggernaut 
            lrwxrwxrwx 1 root root 40 Sep 20 02:48 /usr/local/bin/juggernaut -> ../lib/node_modules/juggernaut/server.js

我尝试更改

        DAEMON=/usr/bin/juggernaut

        DAEMON=/usr/local/bin/juggernaut

之后我尝试使用

         sudo /etc/init.d/juggernaut start

服务器启动但不作为后台进程/服务重新启动主宰。

编辑

在调试模式下运行脚本,即 更改顶部的 shebang 行以添加 -x,例如,

    #! /bin/bash -x

这是输出:-

   + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
   + DAEMON=/usr/bin/juggernaut
   + NAME=Juggernaut2
   + DESC=Juggernaut2
   + PIDFILE=/var/run/juggernaut.pid
   + test -x /usr/bin/juggernaut
   + exit 0

编辑

更改我的主宰的路径,因为我的主宰似乎安装在其他地方。现在这是输出

    fizzy@li136-198:~$ sudo /etc/init.d/juggernaut start
    + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    + DAEMON=/usr/local/bin/juggernaut
    + NAME=Juggernaut2
    + DESC=Juggernaut2
    + PIDFILE=/var/run/juggernaut.pid
    + test -x /usr/local/bin/juggernaut
    + set -e
    + case "$1" in
    + echo -n 'Starting Juggernaut2: '
    Starting Juggernaut2: + touch /var/run/juggernaut.pid
    + chown juggernaut:juggernaut /var/run/juggernaut.pid
    + start-stop-daemon --start --quiet --umask 007 --pidfile /var/run/juggernaut.pid --chuid juggernaut:juggernaut --exec /usr/local/bin/juggernaut
    20 Sep 06:41:16 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This will slow down initial connections slightly.
    20 Sep 06:41:16 - socket.io ready - accepting connections

    node.js:134
            throw e; // process.nextTick error, or 'error' event on first tick
            ^
    Error: EADDRINUSE, Address already in use
        at Server._doListen (net.js:1106:5)
        at net.js:1077:14
        at Object.lookup (dns.js:153:45)
        at Server.listen (net.js:1071:20)
        at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/server.js:51:21)
        at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/index.js:9:10)
        at Object.<anonymous> (/usr/local/lib/node_modules/juggernaut/server.js:21:12)
        at Module._compile (module.js:402:26)
        at Object..js (module.js:408:10)
        at Module.load (module.js:334:31)
    + echo failed
    failed
    + exit 0

I am using juggernaut push server. How to start redis and juggernaut in production mode cause I

 juggernaut

or

redis-server will keep on showing me log etc.

I am using ruby on rails 3.

EDIT

I followed these two guides to setup juggernaut and redis on production server

Terminal commands.

Seems like both the servers are running smooth now. But how can i access

     :8080/application.js for juggernaut. 

I tried

   my_ip:8080/application.js but nothing. 

For hosting I am using Linode.

EDIT2

When I am trying to stop/start redis server its gives me output ie:

  Starting/Stopping redis-server: redis-server.

But nothing when i m doing the same for juggernaut. Check screenshot.

enter image description here

EDIT

I can't see any log for juggernaut.. There is one for redis but nothin for juggernaut

enter image description here

EDIT

  1. Executable file permissions to /etc/init.d/juggernaut file -- YES

        -rwxr-xr-x 1 fizzy fizzy 1310 Sep 19 11:06 juggernaut
    
  2. PIDFILE=/var/run/juggernaut.pid' is defined. Does that exist? --- NO

  3. In the 'start' part it runs 'chown juggernaut:juggernaut'. Does the user juggernaut exist and is it member of the group juggernaut? -- YES/YES

      cat /etc/group
          redis:x:1002:
          juggernaut:x:113:
    
      groups juggernaut
          juggernaut : juggernaut
    

EDIT

     fizzy@li136-198:~$ sudo ls -l /usr/bin/juggernaut 
              ls: cannot access /usr/bin/juggernaut: No such file or directory
     fizzy@li136-198:~$ sudo ls -l /usr/local/bin/juggernaut 
            lrwxrwxrwx 1 root root 40 Sep 20 02:48 /usr/local/bin/juggernaut -> ../lib/node_modules/juggernaut/server.js

I tried changing

        DAEMON=/usr/bin/juggernaut

to

        DAEMON=/usr/local/bin/juggernaut

after that i tried restarting the juggernaut using

         sudo /etc/init.d/juggernaut start

Server started but not as background process/service.

EDIT

Running script in debugging mode ie
changing the shebang line at the top to add an -x, eg

    #! /bin/bash -x

Here is the output:-

   + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
   + DAEMON=/usr/bin/juggernaut
   + NAME=Juggernaut2
   + DESC=Juggernaut2
   + PIDFILE=/var/run/juggernaut.pid
   + test -x /usr/bin/juggernaut
   + exit 0

EDIT

Changing path of my juggernaut as it seems my juggernaut is installed somewhere else. Now here is the output

    fizzy@li136-198:~$ sudo /etc/init.d/juggernaut start
    + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    + DAEMON=/usr/local/bin/juggernaut
    + NAME=Juggernaut2
    + DESC=Juggernaut2
    + PIDFILE=/var/run/juggernaut.pid
    + test -x /usr/local/bin/juggernaut
    + set -e
    + case "$1" in
    + echo -n 'Starting Juggernaut2: '
    Starting Juggernaut2: + touch /var/run/juggernaut.pid
    + chown juggernaut:juggernaut /var/run/juggernaut.pid
    + start-stop-daemon --start --quiet --umask 007 --pidfile /var/run/juggernaut.pid --chuid juggernaut:juggernaut --exec /usr/local/bin/juggernaut
    20 Sep 06:41:16 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This will slow down initial connections slightly.
    20 Sep 06:41:16 - socket.io ready - accepting connections

    node.js:134
            throw e; // process.nextTick error, or 'error' event on first tick
            ^
    Error: EADDRINUSE, Address already in use
        at Server._doListen (net.js:1106:5)
        at net.js:1077:14
        at Object.lookup (dns.js:153:45)
        at Server.listen (net.js:1071:20)
        at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/server.js:51:21)
        at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/index.js:9:10)
        at Object.<anonymous> (/usr/local/lib/node_modules/juggernaut/server.js:21:12)
        at Module._compile (module.js:402:26)
        at Object..js (module.js:408:10)
        at Module.load (module.js:334:31)
    + echo failed
    failed
    + exit 0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾铮苏瑾 2024-12-11 18:06:22

您可能希望将 Juggernaut 和 Redis 作为服务/后台进程启动。将其作为服务启动可以将日志重定向到一个文件,然后您可以定期检查该文件。

要创建在启动时自动启动的服务,您必须根据您使用的操作系统执行不同的操作:

确保在创建服务后启动服务,方法是将服务添加到默认运行级别(将在启动时自动启动)或手动启动它们。

将服务添加到默认运行级别(Linux),也是上面两个Linux教程的一部分:

sudo update-rc.d -f juggernaut defaults
sudo update-rc.d -f redis-server defaults

将服务添加到默认运行级别后,您仍然需要手动启动服务(Linux):

sudo /etc/init.d/juggernaut start
sudo /etc/init.d/redis-server start

You probably want to start Juggernaut and Redis as a service / background process. Starting it as a service gives the opportunity to redirect the logs to a file which you then can inspect regularly.

To create a service that automatically starts at boot time, you have to do different things based on the OS you're using:

Make sure you start the services after creating them by adding the service to the default runlevel (will start automatically during boot time) or start them manually.

Add service to default runlevel (Linux), is also part of both the Linux tutorials above:

sudo update-rc.d -f juggernaut defaults
sudo update-rc.d -f redis-server defaults

After adding the service to the default runlevel, you still need to start the service manually (Linux):

sudo /etc/init.d/juggernaut start
sudo /etc/init.d/redis-server start
难得心□动 2024-12-11 18:06:22

我遇到了同样的问题(使用 Ubuntu 12.04 LTS)。使用 upstart 为我做到了。

创建一个文件“juggernaut.conf”,其中包含:

start on filesystem and started networking
stop on shutdown

script
    # We found $HOME is needed. Without it, we ran into problems
    export HOME="/root"

    exec /usr/local/bin/juggernaut 2>&1 >> /var/log/juggernaut.log
end script

将此文件保存在 /etc/init/(不是 init.d)中并使其可执行(chmod +x)。就是这样,如果服务器启动,Juggernaut 将作为守护进程运行。

注意:在 juggernaut 本身的 juggernaut.log 旁边,有一个位于 /var/log/upstart/ 的 juggernaut.log,其中记录了 upstart 尝试启动 juggernaut 的信息。

我或多或少地从 此博客。但是,那里显示的脚本开头为:

 start on startup

这对我不起作用,因为文件系统在启动时未正确安装,因此不可能创建 juggernaut.log (只读文件系统错误)。归功于这篇文章在服务器故障上解决这个问题。

I ran into the same problem (using Ubuntu 12.04 LTS). Using upstart did it for me.

Create a file 'juggernaut.conf' containing:

start on filesystem and started networking
stop on shutdown

script
    # We found $HOME is needed. Without it, we ran into problems
    export HOME="/root"

    exec /usr/local/bin/juggernaut 2>&1 >> /var/log/juggernaut.log
end script

Save this file in /etc/init/ (not init.d) and make it executable (chmod +x). This is it, Juggernaut runs as a deamon if the server started.

A note: next to the juggernaut.log of juggernaut itself, there is a juggernaut.log located in /var/log/upstart/ where information is written on the attempts of upstart to start juggernaut.

I more or less copy-pasted the above script from this blog . However, the script shown there started with:

 start on startup

This did not work for me, because the filesystem was not mounted properly at startup, so no possibility to create juggernaut.log (Read-only filesystem error). Credits to this post on serverfault for solving that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文