Centos7.2 搭建emqttd集群,添加自启动服务
关闭防火墙(可选):
systemctl stop firewalld.service
1.安装依赖库
> sudo yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
2.获取源码包
> wget http://www.erlang.org/download/otp_src_R13B04.tar.gz
3.解压、编译、安装
> tar xfvz otp_src_R13B04.tar.gz
> cd otp_src_R13B04/
> ./configure --with-ssl
> make install
4.可能遇到的错误
http://blog.csdn.net/laughing_cui/article/details/53322790
5.emqttd程序包下载
Debian http://emqtt.com/downloads/latest/debian
Ubuntu http://emqtt.com/downloads/latest/ubuntu
CentOS http://emqtt.com/downloads/latest/centos
FreeBSD http://emqtt.com/downloads/latest/freebsd
Mac OS X http://emqtt.com/downloads/latest/macosx
Windows http://emqtt.com/downloads/latest/windows
6.Linux服务器安装(以Centos为例)
wget http://emqtt.com/docs/v2/install.html#linux
1、解压缩包(可以官网下载)
> unzip emqttd-centos64-1.1-beta-20160601.zip
2、控制台调试模式启动,检查emqttd是否可正常启动:
> vim /opt/emqttd/etc/emq.conf
修改node.name = emqttd@172.30.60.3
> cd /opt/emqttd
> ./bin/emqttd console
emqttd消息服务器如启动正常,控制台输出:
starting emqttd on node 'emqttd@127.0.0.1'
emqttd ctl is starting...[done]
emqttd trace is starting...[done]
emqttd pubsub is starting...[done]
emqttd stats is starting...[done]
emqttd metrics is starting...[done]
emqttd retainer is starting...[done]
emqttd pooler is starting...[done]
emqttd client manager is starting...[done]
emqttd session manager is starting...[done]
emqttd session supervisor is starting...[done]
emqttd broker is starting...[done]
emqttd alarm is starting...[done]
emqttd mod supervisor is starting...[done]
emqttd bridge supervisor is starting...[done]
emqttd access control is starting...[done]
emqttd system monitor is starting...[done]
http listen on 0.0.0.0:18083 with 4 acceptors.
mqtt listen on 0.0.0.0:1883 with 16 acceptors.
mqtts listen on 0.0.0.0:8883 with 4 acceptors.
http listen on 0.0.0.0:8083 with 4 acceptors.
Erlang MQTT Broker 1.1 is running now
Eshell V6.4 (abort with ^G)
(emqttd@127.0.0.1)1>
CTRL+c关闭控制台。守护进程模式启动:
> ./bin/emqttd start
emqttd消息服务器进程状态查询:
> ./bin/emqttd_ctl status
正常运行状态,查询命令返回:
Node 'emqttd@127.0.0.1' is started
emqttd 1.1 is running
部署好EMQ之后,访问URL地址:http://172.30.60.3:18083 ,缺省用户名/密码: admin/public
停止服务器:
> ./bin/emqttd stop
节点加入集群(有两种集群添加方式:IP(推荐)和主机域名):
主机域名举例:
首先修改主机名,加入主机名.域名
vim /etc/hosts
例如:
127.0.0.1 s1 s1.emqtt.io
172.30.60.30 s1 s1.emqtt.io(第一台)
172.30.60.37 s2 s2.emqtt.io(第二台)
172.30.60.22 s3 s3.emqtt.io(第三台)
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
然后修改配置文件emq.conf
node.name=emq@主机名.域名
然后启动emqttd
emqttd>bin/emqttd start
最后节点加入集群
emqttd>./bin/emqttd_ctl cluster join emqttd@s1.emqtt.io
查看集群状态
emqttd>./bin/emqttd_ctl cluster status
节点退出集群:
./bin/emqttd_ctl cluster leave
或emqttd@s1.emqtt.io节点上,从集群删除emqttd@s2.emqtt.io节点:
./bin/emqttd_ctl cluster remove emqttd@s2.emqtt.io
emqttd开机自启动:
在此目录下面新建文件emqttd.service
vim /usr/lib/systemd/system/emqttd.service
加入配置文件
[Unit]
Description=emqttdapi
After=network.target
[Service]
Type=forking
Environment=HOME=/opt/emqttd
ExecStart=/opt/emqttd/bin/emqttd start
ExecReload=/opt/emqttd/bin/emqttd reboot
ExecStop=/opt/emqttd/bin/emqttd stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
最后执行命令
systemctl enable emqttd.service
集群间需要开端口:监听端口、配置文件emq.conf里面的端口区间、4369端口
(可参考官方文档)
Centos7.2 搭建emqttd集群,添加自启动服务的更多相关文章
- linux系统centOS7下搭建redis集群中ruby版本过低问题的解决方法
问题描述: 在Centos7中,通过yum安装ruby的版本是2.0.0,但是如果有些应用需要高版本的ruby环境,比如2.2,2.3,2.4... 那就有点麻烦了,譬如:我准备使用redis官方给的 ...
- Centos7上搭建activemq集群和zookeeper集群
Zookeeper集群的搭建 1.环境准备 Zookeeper版本:3.4.10. 三台服务器: IP 端口 通信端口 10.233.17.6 2181 2888,3888 10.233.17.7 2 ...
- centos7 快速搭建redis集群环境
本文主要是记录一下快速搭建redis集群环境的方式. 环境简介:centos 7 + redis-3.2.4 本次用两个服务6个节点来搭建:192.168.116.120 和 192.168.1 ...
- 在CentOS7中搭建Zookeeper集群
前几天装了CentOS7.并安装了一些基本的工具,现在我手上有三台机器:分别是master,slave1,slave2. 今天我将搭建zookeeper,使用的版本是zookeeper-3.4.11. ...
- centos7上搭建zookeeper集群
1.下载zookeeper http://www.apache.org/dyn/closer.cgi/zookeeper/ 可以登录这个网站下载,然后上传到 centos上 修改成自己需要的版本 , ...
- CentOs7.3 搭建 SolrCloud 集群服务
一.概述 Lucene是一个Java语言编写的利用倒排原理实现的文本检索类库: Solr是以Lucene为基础实现的文本检索应用服务.Solr部署方式有单机方式.多机Master-Slaver方式.C ...
- 02.centos7上搭建hadoop集群
接上一篇 https://www.cnblogs.com/yjm0330/p/10069224.html 一.准备工作:无密登陆 1.编辑/etc/hosts文件,分别增加 192.168.2.24 ...
- 使用Docker搭建consul集群+registrator实现服务自动注册。
准备工作:10.173.16.83 master10.172.178.76 node110.171.19.139 node210.162.204.252 node3 一.安装consul-cluste ...
- Centos7环境下etcd集群的搭建
Centos7环境下etcd集群的搭建 一.简介 "A highly-available key value store for shared configuration and servi ...
随机推荐
- Sleep-Join方法理解
package cn.mayday.test; public class JoinTest { public static void main(String[] args) { try { int c ...
- DiskFileItemFactory用法
在使用servlet上传文件时,使用DiskFileItemFactory(在使用struts时利用InputStream和OutputStream) 将请求消息实体中的每一个项目封装成单独的Disk ...
- 数字签名 转载:http://www.youdzone.com/signature.html
What is a Digital Signature?An introduction to Digital Signatures, by David Youd Bob (Bob's public k ...
- Java反射的使用
反射的概述 1.Java反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法. 2.对于任意一个对象,都能调用它的任意一个方法和属性. 3.通过动态获取的信息以及动态调用对象的方法 ...
- vue 多层组件相互嵌套的时候 数据源更新 dom没更新 彻底清除组件缓存
当项目中存在多层组件相互嵌套 组件存在严重缓存时 this.$nextTick(() => { ..... }); 不管用 this.$forceUpdate(); 不管用 只能通过深拷贝浅拷 ...
- [codeforces792C][dp]
https://codeforc.es/contest/792/problem/C C. Divide by Three time limit per test 1 second memory lim ...
- Idea使用Lombok简化实体类代码
引入相应的maven包 <dependency> <groupId>org.projectlombok</groupId> <artifactId>lo ...
- For 循环的嵌套与九九乘法表
㈠通过程序,在页面中输入如下图形 * * * * * * * * * * * * * * * * * * * * * * * * * 代码如下: //向body中输入一个内容 //document. ...
- pycharm mysql数据源配置、SQL方言配置
会发现有提示,看着不爽,但不影响运行程序, 这里提示没有配置数据源,现在配置MYSQL数据源 然后看到右边Database选项卡,点击 然后可能会出现网络防火墙提示,选择全部允许,之后可能会在pych ...
- Microsoft Enterprise Library 5.0 系列教程(四) Logging Application Block
Download dll: http://www.microsoft.com/en-us/download/confirmation.aspx?id=15104 http://www.cnblogs. ...