ロケ地:AWS EC2 CentOS7.2@m3.medium
passenger-status が使えない
passenger-status を呼ぶと以下のように怒られる。
ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it is running, then the causes of this problem could be: 1. You customized the instance registry directory using Apache's PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir option, or Phusion Passenger Standalone's --instance-registry-dir command line argument. If so, please set the environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory and run passenger-status again. 2. The instance directory has been removed by an operating system background service. Please set a different instance registry directory using Apache's PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir option, or Phusion Passenger Standalone's --instance-registry-dir command line argument.
なんか前にも調べた気がするけど以下の通りらしい。
[root@ip-11-4-51-4 ~]# ls -la /tmp/ .. drwx------ 3 root root 16 Nov 7 14:40 systemd-private-aaaabbbbccccddddeeeeffffgggghhhh-httpd.service-5v2rlt ..
ありました。めんどくさいので今回はコマンドに「PASSENGER_INSTANCE_REGISTRY_DIR」を指定しましょう!
[root@ip-11-4-51-4 ~]# PASSENGER_INSTANCE_REGISTRY_DIR=/tmp/systemd-private-aaaabbbbccccddddeeeeffffgggghhhh-httpd.service-5v2rlt/tmp/ passenger-status Version : 5.0.30 Date : 2016-11-07 20:06:10 +0900 Instance: 114514 (Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.5.34 Phusion_Passenger/5.0.30) /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb:94:in `initialize': too long unix socket path (115bytes given but 108bytes max) (ArgumentError) from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb:94:in `new' from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb:94:in `http_request' from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/bin/passenger-status:113:in `show_status' from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/bin/passenger-status:61:in `command_show_status' from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/bin/passenger-status:332:in `start' from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/bin/passenger-status:335:in `<top (required)>' from /usr/local/bin/passenger-status:23:in `load' from /usr/local/bin/passenger-status:23:in `<main>'
too long unix socket path
という訳でタイトルになります。「PASSENGER_INSTANCE_REGISTRY_DIR」で指定されているディレクトリ名が流すぎるのが原因のようです。 試しにシンボリックリンクを設定してみましょう!
シンボリックリンクを作成する
[root@ip-11-4-51-4 ~]# cd /tmp/ [root@ip-11-4-51-4 ~]# ln -s /tmp/systemd-private-aaaabbbbccccddddeeeeffffgggghhhh-httpd.service-5v2rlt/tmp/ test_path
passenger-status を再度実行してみる
[root@ip-11-4-51-4 ~]# PASSENGER_INSTANCE_REGISTRY_DIR=/tmp/test_path/ passenger-status Version : 5.0.30 Date : 2016-11-07 20:06:10 +0900 Instance: 114514 (Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.5.34 Phusion_Passenger/5.0.30) ----------- General information ----------- Max pool size : 6 App groups : 1 Processes : 1 Requests in top-level queue : 0 ----------- Application groups ----------- /var/www/test_app (production): App root: /var/www/test_app Requests in queue: 0 * PID: 21062 Sessions: 0 Processed: 7 Uptime: 33m 31s CPU: 0% Memory : 68M Last used: 3m 1s ago
出ましたね! これで、「PASSENGER_INSTANCE_REGISTRY_DIR=/tmp/test_path/」を指定していれば、passenger-config restart-app なども実行できます。