activemq安装配置、外网禁用8161端口

1. 禁止外网端口访问 
到activemq 的conf目录中找到jetty.xml  
 <bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
             <!-- the default port number for the web console -->
        <property name="host" value="0.0.0.0"/>
        <property name="port" value="8161"/>
    </bean>
把 name="host" 行的value的值0.0.0.0 修改成 127.0.0.1  然后重启即可


2. activemq安全设置—设置admin的用户名和密码:

ActiveMQ使用的是jetty服务器, 打开conf/jetty.xml文件,找到

<bean id="adminSecurityConstraint"class="org.eclipse.jetty.util.security.Constraint">
 <property name="name"value="BASIC"/>
 <property name="roles"value="admin"/>
 <!-- set authenticate=false to disable login -->
 <property name="authenticate"value="true"/>
</bean>
        将property name为authenticate的属性value="true"改为"false",登录http://localhost:8161/admin/时就不会弹出用户名密码要求输入。authenticate的属性value="true" 时,控制台的登录用户名密码保存在conf/jetty-realm.properties文件中,内容如下:
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the"License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an"AS IS"BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------

# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin
user: user, user


3. activemq 的安装配置
    linux上安装activeMQ

1.新建一个文件夹activeMQ
  mkdir /server

2.授权 
  chmod 777 /server

3.下载activeMQ安装包,拷贝到/activeMQ目录下
apache-activemq-5.6.0-bin.tar.gz,下载地址http://activemq.apache.org/download.html

4.解压文件到运行目录/activeServer
tar -xzvf /server/apache-activemq-5.6.0-bin.tar.gz

5.修改activemq运行文件的权限 
cd /server/apache-activemq-5.6.2/bin 
chmod 755 activemq 
运行./activemq

6.运行
三种运行方式:
(1)普通启动 ./activemq start
(2)启动并指定日志文件 ./activemq start &gt;tmp/smlog
(3)后台启动方式nohup ./activemq start &gt;/tmp/smlog
前两种方式下在命令行窗口关闭时或者ctrl+c时导致进程退出,采用后台启动方式则可以避免这种情况

7.检查已经启动
 ActiveMQ默认采用61616端口提供JMS服务,使用8161端口提供管理控制台服务,执行以下命令以便检验是否已经成功启动ActiveMQ服务。
打开端口:nc -lp 61616 &
查看哪些端口被打开 netstat -anp
查看61616端口是否打开: netstat -an | grep 61616
检查是否已经启动:
(1).查看控制台输出或者日志文件 
(2).直接访问activemq的管理页面:http://localhost:8161/admin/

8.关闭
如果开启方式是使用(1)或(2),则直接ctrl+c或者关闭对应的终端即可 
如果开启方式是(3),则稍微麻烦一点: 
先查找到activemq对应的进程: 
ps -ef | grep activemq 
然后把对应的进程杀掉,假设找到的进程编号为 168168 
kill 168168 
======================

9.清空ActiveMQ  消息队列:
   删除/www/apache-activemq-5.5.0/data/kahadb/  下的文件   然后重启即可


 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值