{"id":642,"date":"2017-07-24T23:30:40","date_gmt":"2017-07-24T14:30:40","guid":{"rendered":"https:\/\/www.ecomott.co.jp\/tech_blog\/?p=642"},"modified":"2018-09-13T10:13:50","modified_gmt":"2018-09-13T01:13:50","slug":"vernemq%ef%bc%88mqtt-broker%ef%bc%89%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.ecomottblog.com\/?p=642","title":{"rendered":"MQTT Broker\u3068\u3057\u3066VerneMQ\u3092\u4f7f\u3063\u3066\u307f\u308b"},"content":{"rendered":"<p>\u307f\u3093\u306a\u5927\u597d\u304d\uff01MQTT\u306f\u3001TCP\/IP\u30d9\u30fc\u30b9\u306e\u8efd\u91cf\u30b7\u30f3\u30d7\u30eb\u306aPub\/Sub\u30e1\u30c3\u30bb\u30fc\u30b8\u30f3\u30b0\u30e2\u30c7\u30eb\u306e\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3059\u3002<\/p>\n<p>\u3054\u5b58\u77e5\u306e\u901a\u308a\u3001AWS IoT\u3084Azure IoTHub\u306a\u3069\u306e\u30af\u30e9\u30a6\u30c9\u30b5\u30fc\u30d3\u30b9\u3067\u3082MQTT Broker\u304c\u63d0\u4f9b\u3055\u308c\u3066\u304a\u308a\u3001\u3053\u3046\u3057\u305f\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3046\u6a5f\u4f1a\u3082\u591a\u3044\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u672c\u8a18\u4e8b\u3067\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u30d6\u30ed\u30fc\u30ab\u30fc\u3067\u3042\u308b<a href=\"https:\/\/vernemq.com\/\" title=\"VerneMQ\">VerneMQ<\/a>\u3092\u4f7f\u3063\u3066\u3001\u81ea\u529b\u3067MQTT Broker\u7acb\u3061\u4e0a\u3052\u3066\u307f\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>VerneMQ\u3068\u306f<\/h2>\n<p>VerneMQ\u306f\u3001Erlio GmbH\u793e\u304c\u958b\u767a\u3057\u3066\u3044\u308bMQTT Broker\u3067\u3001Apache license 2.0\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002Erlang\/OTP\u3067\u66f8\u304b\u308c\u3066\u304a\u308a\u3001\u30af\u30e9\u30b9\u30bf\u3092\u7d44\u3080\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u6c17\u306b\u306a\u308b&#8221;VerneMQ&#8221;\u306e\u767a\u97f3\u3067\u3059\u304c\u3001\u6d77\u5916YouTube\u306e\u52d5\u753b\u3092\u307f\u3066\u3044\u308b\u3068\u3001Verne\u306e\u6700\u5f8c\u306e&#8221;e&#8221;\u304c\u6b21\u306e&#8221;M&#8221;\u3068\u91cd\u306a\u3063\u3066&#8221;\u3079\u308b\u306d\u3080\u304d\u3085\u30fc&#8221;\u3068\u767a\u97f3\u3057\u3066\u3044\u308b\u611f\u3058\u3067\u3059\u3002<br \/>\n\uff03\u3068\u3044\u3044\u3064\u3064\u3001\u79c1\u306f&#8221;\u3079\u308b\u306d\u30fb\u3048\u3080\u304d\u3085\u30fc&#8221;\u3068\u8aad\u3093\u3067\u307e\u3059<\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>\u305d\u308c\u3067\u306fAWS EC2\u4e0a\u3067\u3084\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002debian, ubuntu, redhat\u5411\u3051\u306e\u30d0\u30a4\u30ca\u30ea\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u7c21\u5358\u3067\u3059\u3002\u307e\u305a\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3001yum install\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"bash\">$ sudo yum install VerneMQ-1.1.0-1.el7.centos.x86_64.rpm\n<\/code><\/pre>\n<h2>vernemq.conf\u306e\u8a2d\u5b9a<\/h2>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f\u3001\/etc\/vernemq\/vernemq.conf \u306b\u3042\u308a\u307e\u3059\u3002\u3072\u3068\u307e\u305a\u4eca\u56de\u306f\u3001\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3067\u52d5\u304b\u3057\u3066\u307f\u307e\u3059\u3002\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u8a2d\u5b9a\u306e\u901a\u308a\u3067\u3057\u305f\u3002<\/p>\n<pre><code class=\"bash\">allow_anonymous = off   #\u533f\u540d\u3067\u306e\u63a5\u7d9a\u3092\u7981\u6b62\n\nplugins.vmq_passwd = on #\u30d1\u30b9\u30ef\u30fc\u30c9\u30d5\u30a1\u30a4\u30eb\u3067\u8a8d\u8a3c\u3059\u308b\nvmq_passwd.password_file = \/etc\/VerneMQ\/vmq.passwd\n\nplugins.vmq_acl = on #ACL\u30d5\u30a1\u30a4\u30eb\u3067\u8a8d\u53ef\u3059\u308b\nvmq_acl.acl_file = \/etc\/VerneMQ\/vmq.acl\n\nvmq_passwd.password_reload_interval = 0 #\u5909\u66f4\u306f\u5373\u5ea7\u306b\u53cd\u6620\u3059\u308b\n<\/code><\/pre>\n<h2>passwd\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<\/h2>\n<p>\u6b21\u306b\u8a8d\u8a3c\u60c5\u5831\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u304d\u307e\u3059\u3002VerneMQ\u306b\u63a5\u7d9a\u3059\u308b\u30e6\u30fc\u30b6\u306f\u3001vmq-passwd \u30b3\u30de\u30f3\u30c9\u3067\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002-c \u30aa\u30d7\u30b7\u30e7\u30f3\u3067passwd\u30d5\u30a1\u30a4\u30eb\u306e\u65b0\u898f\u4f5c\u6210\u3001-D \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u524a\u9664\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u30e6\u30fc\u30b6 pub \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"bash\">$ sudo vmq-passwd -c \/etc\/vernemq\/vmq.passwd pub\n<\/code><\/pre>\n<p>\u540c\u69d8\u306b\u3001sub1, sub2 \u30e6\u30fc\u30b6\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3059\u3067\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u306e\u3067\u3001-c \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre><code class=\"bash\">$ sudo vmq-passwd \/etc\/vernemq\/vmq.passwd sub1\n$ sudo vmq-passwd \/etc\/vernemq\/vmq.passwd sub2\n<\/code><\/pre>\n<h2>acl\u8a2d\u5b9a<\/h2>\n<p>\u6b21\u306b\u3001acl\u30d5\u30a1\u30a4\u30eb\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002acl\u30d5\u30a1\u30a4\u30eb\u306f\u3001VerneMQ\u306b\u63a5\u7d9a\u3057\u305f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u4f55\u306e\u30c8\u30d4\u30c3\u30af\u306b\u5bfe\u3057\u3066publish, subscribe\u3067\u304d\u308b\u304b\u3092\u5b9a\u7fa9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u306f\u3001vernemq.conf\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u3054\u3068\u306b\u30eb\u30fc\u30eb\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u304f\u3068\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u6570\u304c\u591a\u304f\u306a\u3063\u305f\u3068\u304d\u306b\u7ba1\u7406\u304c\u5927\u5909\u306b\u306a\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u306a\u304c\u3089MQTT\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u3001\u73fe\u5b9f\u7684\u306b\u306f\u3001\u7279\u5b9atopic\u3078\u306epublish\u3068\u81ea\u5206\u81ea\u8eab\u3078\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u307fsubscribe\u3067\u5341\u5206\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3082\u591a\u3044\u3067\u3059\u3002\u3053\u3046\u3057\u305f\u5834\u5408\u3001VerneMQ\u3067\u306ftopic\u306e\u6307\u5b9a\u306b\u6587\u5b57\u30af\u30e9\u30b9\u304c\u6307\u5b9a\u53ef\u80fd\u306a\u306e\u3067\u3001\u3053\u308c\u3092\u6d3b\u7528\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070  %u \u306f\u63a5\u7d9a\u6642\u306e\u30e6\u30fc\u30b6\u540d\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6307\u5b9a\u306e\u5834\u5408\u3001\u3059\u3079\u3066\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u3001data\/(\u63a5\u7d9a\u3057\u305f\u30e6\u30fc\u30b6ID) \u306etopic\u3092subscrible\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"bash\">pattern read user\/%u\n<\/code><\/pre>\n<p>\u3055\u3089\u306b\u8a18\u8ff0\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3068\u3001pub1 \u30e6\u30fc\u30b6\u306f\u3001data\/ \u4ee5\u4e0b\u306e\u3059\u3079\u3066\u306etopic\u306b\u5bfe\u3057\u3001publish\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"bash\">pattern read user\/%u\n\nuser pub\ntopic write user\/+\n<\/code><\/pre>\n<p>\u9577\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u6b21\u56de\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u5b9f\u969b\u306b publish\/subscribe\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u307f\u3093\u306a\u5927\u597d\u304d\uff01MQTT\u306f\u3001TCP\/IP\u30d9\u30fc\u30b9\u306e\u8efd\u91cf\u30b7\u30f3\u30d7\u30eb\u306aPub\/Sub\u30e1\u30c3\u30bb\u30fc\u30b8\u30f3\u30b0\u30e2\u30c7\u30eb\u306e\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3059\u3002 \u3054\u5b58\u77e5\u306e\u901a\u308a\u3001AWS IoT\u3084Azure IoTHub\u306a\u3069\u306e\u30af\u30e9\u30a6\u30c9\u30b5\u30fc\u30d3\u30b9\u3067\u3082MQTT Broker\u304c\u63d0 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[31],"_links":{"self":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/642"}],"collection":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=642"}],"version-history":[{"count":23,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/642\/revisions"}],"predecessor-version":[{"id":644,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/642\/revisions\/644"}],"wp:attachment":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}