{"id":7331,"date":"2019-11-23T11:04:24","date_gmt":"2019-11-23T02:04:24","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=7331"},"modified":"2023-05-27T23:00:31","modified_gmt":"2023-05-27T14:00:31","slug":"%e3%80%90ruby-on-rails%e3%80%91%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%b5%e3%83%bc%e3%83%90%e3%80%8cpuma%e3%80%8d%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=7331","title":{"rendered":"\u3010Ruby on Rails\u3011\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u300cPuma\u300d\u3001\u300cUnicorn\u300d\u306b\u3064\u3044\u3066"},"content":{"rendered":"<h2>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u3068\u306f\uff1f<\/h2>\n<p><span style=\"color: #ff0000;\"><strong>Rails\u3092\u52d5\u304b\u3059\u305f\u3081\u306e\u30b5\u30fc\u30d0<\/strong><\/span>\u306e\u3053\u3068\u3067\u3001Web\u30b5\u30fc\u30d0\u306e\u5f79\u5272\u3082\u304b\u306d\u308b\u3053\u3068\u304c\u3067\u304d\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5143\u306b\u30ea\u30b9\u30dd\u30f3\u30b9\u3082\u8fd4\u305b\u307e\u3059\u3002<\/p>\n<h2>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u306e\u7a2e\u985e<\/h2>\n<p>Rails\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u306b\u306f\u69d8\u3005\u306a\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u5c11\u306a\u304f\u3068\u3082Rails6(2019\u5e7411\u6708\u73fe\u5728\uff09\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067<span style=\"color: #ff0000;\"><strong>\u300c<\/strong><strong>Puma\u300d<\/strong><\/span>\u304c\u63a1\u7528\u3055\u308c\u3066\u307e\u3059\u3002\uff08\u306a\u304a\u3001Rails4\u4ee5\u524d\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u3068\u3057\u3066\u300cWebrick\u300d\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001Webrick\u3088\u308aPuma\u306e\u65b9\u304c\u901f\u5ea6\u304c\u304b\u306a\u308a\u65e9\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002\uff09<\/p>\n<h2>\u52d5\u4f5c\u306e\u4ed5\u7d44\u307f<\/h2>\n<h3>\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9<\/h3>\n<p>1\u30d7\u30ed\u30bb\u30b9\u306e\u4e2d\u3067\u8907\u6570\u306e\u51e6\u7406\u3092\u540c\u6642\u306b\u6271\u3046\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u3067\u52d5\u4f5c\u3057\u307e\u3059\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u3067<span style=\"color: #ff0000;\"><strong>\u5927\u91cf\u306e\u30a2\u30af\u30bb\u30b9\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/span>DB\u30a2\u30af\u30bb\u30b9\u306a\u3093\u304b\u306f\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u30a2\u30af\u30bb\u30b9\u8ca0\u8377\u306b\u8010\u3048\u3089\u308c\u308b\u3088\u3046\u306b\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u30d7\u30fc\u30ea\u30f3\u30b0\u306e\u4ed5\u7d44\u307f\u304c\u3042\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u74b0\u5883\u5909\u6570<span style=\"color: #ff0000;\"><strong>\u300cRAILS_MAX_THREADS\u300d<\/strong><\/span>\u3068\u8a00\u3046\u5909\u6570\u3067Rails\u306e\u6700\u5927\u30b9\u30ec\u30c3\u30c9\u6570\u3092\u6c7a\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u3067\u52d5\u304f\u306e\u3067\u3001\u30d7\u30ed\u30bb\u30b9\u3092\u5897\u3084\u3059\u5fc5\u8981\u304c\u306a\u3044\u305f\u3081\u3001\u30ea\u30bd\u30fc\u30b9\u304c\u5c11\u306a\u3044\u4e2d\u3067\u3082\u52b9\u7387\u7684\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u3055\u3070\u304f\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308b\u3002<\/p>\n<h3>\u5b9f\u88c5\u4e0a\u306e\u6ce8\u610f\u70b9<\/h3>\n<p>\u30b9\u30ec\u30c3\u30c9\u30bb\u30fc\u30d5\u306a\u30b3\u30fc\u30c9\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n<ul>\n<li>\u30af\u30e9\u30b9\u5909\u6570\u306a\u3069\u306f\u6975\u529b\u4f7f\u308f\u306a\u3044\u3002<\/li>\n<\/ul>\n<h3>\u300cA server is already running.\u300d\u3068\u51fa\u308b\u5834\u5408\u306e\u5bfe\u51e6\u6cd5<\/h3>\n<p>Rails\u3067\u300crails s\u300d\u3068puma\u3092\u8d77\u52d5\u3057\u3088\u3046\u3068\u3057\u305f\u969b\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"\">A server is already running.<\/pre>\n<p><span style=\"color: #ff0000;\"><strong>\u4ed6\u306e\u30b3\u30de\u30f3\u30c9\u3067\u8d77\u52d5\u3057\u305fpuma\u304c\u540c\u3058\u30dd\u30fc\u30c8\u3092\u63b4\u3093\u3067\u3057\u307e\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u539f\u56e0<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h4>\u5bfe\u51e6\u6cd5<\/h4>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u30663000\u756a\u30dd\u30fc\u30c8\uff08Puma\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30dd\u30fc\u30c8\u756a\u53f7\uff09\u3092\u3069\u306e\u30d7\u30ed\u30bb\u30b9\u304c\u63b4\u3093\u3067\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \">sudo lsof -i:3000<\/pre>\n<p>\u305d\u3046\u3059\u308b\u3068\u5bfe\u8c61\u30b3\u30de\u30f3\u30c9\u306ePID\uff08\u30d7\u30ed\u30bb\u30b9ID\uff09\u304c\u308f\u304b\u308b\u306e\u3067\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30d7\u30ed\u30bb\u30b9\u3092\u5f37\u5236\u7d42\u4e86\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">kill -9 \u300clsof\u30b3\u30de\u30f3\u30c9\u3067\u5224\u660e\u3057\u305fPID\u300d<\/pre>\n<p><span style=\"color: #ff0000;\"><strong>\u300c-9\u300d\u3068\u3044\u3046\u306e\u306f\u3001\u901a\u5e38\u306ekill\u306b\u6bd4\u3079\u3066\u5f8c\u51e6\u7406\u3082\u4f55\u3082\u3044\u3089\u306a\u3044\u306e\u3067\u5f37\u5236\u7684\u306b\u7d42\u4e86\u3055\u305b\u306a\u3055\u3044<\/strong><\/span>\u3068\u3044\u3046\u547d\u4ee4\u3089\u3057\u3044\u3067\u3059\u3002\u79c1\u306e\u74b0\u5883\u3067\u306epuma\u30d7\u30ed\u30bb\u30b9\u306f-9\u3092\u3064\u3051\u306a\u3044\u3068\u7d42\u4e86\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u306e\u3067\u3053\u306e\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u518d\u3073\u300crails s\u300d\u3092\u5b9f\u884c\u3059\u308b\u3068puma\u30b5\u30fc\u30d0\u304c\u8d77\u52d5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u672c\u756a\u904b\u7528\u3092\u60f3\u5b9a\u3057\u305f\u5834\u5408<\/h2>\n<p>Puma\u306fWeb\u30b5\u30fc\u30d0\u3068\u3057\u3066\u306e\u6a5f\u80fd\u3092\u517c\u306d\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u901a\u5e38\u306e\u672c\u756a\u904b\u7528\u3067\u306fPuma\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u3068\u3057\u3066\u306e\u6a5f\u80fd\u306b\u7279\u5316\u3055\u305b\u3066\u3001<span style=\"color: #ff0000;\"><strong>Nginx\u3084Apache\u7b49\u306eWeb\u30b5\u30fc\u30d0\u3068\u9023\u643a\u3055\u305b\u305f\u69cb\u6210\u306b\u3059\u308b\u3053\u3068\u304c\u591a\u3044<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h3>Unicorn<\/h3>\n<p>Puma\u3068Unicorn\u306e\u9055\u3044\u306f\u3001Nginx\u3068Apache\u306e\u9055\u3044\u306b\u4f3c\u3066\u3044\u308b\u3002\uff08Nginx\u304cPuma\u3001Unicorn\u306fApache)<\/p>\n<p>\u30de\u30eb\u30c1\u30d7\u30ed\u30bb\u30b9\u3067\u52d5\u304f\u3002Rails\u3067\u4f5c\u6210\u3055\u308c\u305f\u30a2\u30d7\u30ea\u3092\u52d5\u304b\u3059\u305f\u3081\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u3067\u672c\u756a\u74b0\u5883\u306b\u3088\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30bb\u30b9\u3054\u3068\u306b\u901a\u4fe1\u51e6\u7406\u3092\u304a\u3053\u306a\u3046\u306e\u3067\u3001\u91cd\u305f\u3044\u901a\u4fe1\u304c\u3042\u3063\u305f\u5834\u5408\u305d\u3053\u3067\u30d6\u30ed\u30c3\u30af\u3055\u308c\u3066\u5168\u4f53\u304c\u91cd\u304f\u306a\u308b\u3002<br \/>\n\u3053\u308c\u3092\u3055\u3070\u3051\u308b\u3088\u3046\u306b\u3059\u308b\u306b\u306fUnicorn\u306eworker\u6570\u3092\u5897\u3084\u3059\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001CPU\u306e\u30b3\u30a2\u306e\u6570\u306b\u3088\u308b\u51e6\u7406\u5236\u9650\u304c\u3042\u308b\u305f\u3081\u3080\u3084\u307f\u306b\u306f\u5897\u3084\u305b\u306a\u3044\u3002<\/p>\n<p>Unicorn\u3067\u52d5\u304b\u3059\u5834\u5408\u306f\u3001\u30de\u30eb\u30c1\u30d7\u30ed\u30bb\u30b9\u306a\u306e\u3067\u30b9\u30ec\u30c3\u30c9\u30bb\u30fc\u30d5\u306f\u4fdd\u8a3c\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4>\u30d7\u30ed\u30bb\u30b9<\/h4>\n<p>\u4e0b\u8a182\u7a2e\u985e\u306e\u30d7\u30ed\u30bb\u30b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>master\u30d7\u30ed\u30bb\u30b9<\/li>\n<li>worker\u30d7\u30ed\u30bb\u30b9<\/li>\n<\/ul>\n<h5>master\u30d7\u30ed\u30bb\u30b9<\/h5>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u89e3\u91c8\u3059\u308b\u3002<\/p>\n<h5>worker\u30d7\u30ed\u30bb\u30b9<\/h5>\n<p>master\u30d7\u30ed\u30bb\u30b9\u3092fork\u3057\u305fworker\u30d7\u30ed\u30bb\u30b9\u7fa4\u304c\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3059\u308b\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u3068\u306f\uff1f Rails\u3092\u52d5\u304b\u3059\u305f\u3081\u306e\u30b5\u30fc\u30d0\u306e\u3053\u3068\u3067\u3001Web\u30b5\u30fc\u30d0\u306e\u5f79\u5272\u3082\u304b\u306d\u308b\u3053\u3068\u304c\u3067\u304d\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5143\u306b\u30ea\u30b9\u30dd\u30f3\u30b9\u3082\u8fd4\u305b\u307e\u3059\u3002 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u306e\u7a2e\u985e Rails\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7331"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7331"}],"version-history":[{"count":10,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7331\/revisions"}],"predecessor-version":[{"id":20546,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/7331\/revisions\/20546"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7331"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}