Redhat(Linux)上的JBoss管理配置

1  JBoss设置

使用的省略词含义

命令                         操作的含义
JBOSS_HOME        JBoss的安装路径
YOURAPP                应用程序包名称
JAVA_HOME           JDK安装路径
APACHE_HOME     Apache软件的安装路径
YOURCONDIF         JBoss的服务模式(默认有3种:all,default, minimal)

1.1  JBoss安全设置

1.1.1               jmx-console安全设置

1.1.1.1          编辑jboss-web.xml文件

u  编辑jmx-console.war/WEB-INF/jboss-web.xml文件:
[jboss@node1 ~]$ cd JBOSS_HOME/server/default/deploy
[jboss@node1 deploy]$ vi jmx-console.war/WEB-INF/jboss-web.xml

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<!--将-->
<jboss-web>
   <!-- Uncomment the security-domain to enable security. You will
      need to edit the htmladaptor login configuration to setup the
      login modules used to authentication users.  
      <security-domain>java:/jaas/jmx-console</security-domain>
-->
</jboss-web>
<!--修改为-->
<jboss-web>
   <!-- Uncomment the security-domain to enable security. You will
      need to edit the htmladaptor login configuration to setup the
      login modules used to authentication users. -->
      <security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>

1.1.1.2          编辑web.xml文件

u  <?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />编辑jmx-console.war/WEB-INF/web.xml文件:
[jboss@node1 ~]$ cd JBOSS_HOME/server/default/deploy
[jboss@node1 deploy]$ vi jmx-console.war/WEB-INF/web.xml
<!--将-->
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   ......
   <!-- A security constraint that restricts access to the HTML JMX console to users with the role JBossAdmin. Edit the roles to what you want and uncomment the WEB-INF/jboss-web.xml/security-domain element to enable secured access to the HTML JMX console.
   <security-constraint>
     <web-resource-collection>
       <web-resource-name>HtmlAdaptor</web-resource-name>
       <description>An example security config that only allows users with the role JBossAdmin to access the HTML JMX console web application </description>
       <url-pattern>/*</url-pattern>
       <http-method>GET</http-method>
       <http-method>POST</http-method>
     </web-resource-collection>
     <auth-constraint>
       <role-name>JBossAdmin</role-name>
     </auth-constraint>
   </security-constraint>
   -->

<login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>JBoss JMX Console</realm-name>
   </login-config>

<security-role>
      <role-name>JBossAdmin</role-name>
   </security-role>
</web-app>
<!--修改为-->
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   ......
   <!-- A security constraint that restricts access to the HTML JMX console to users with the role JBossAdmin. Edit the roles to what you want and uncomment the WEB-INF/jboss-web.xml/security-domain element to enable secured access to the HTML JMX console.-->
   <security-constraint>
     <web-resource-collection>
       <web-resource-name>HtmlAdaptor</web-resource-name>
       <description>An example security config that only allows users with the role JBossAdmin to access the HTML JMX console web application </description>
       <url-pattern>/*</url-pattern>
       <http-method>GET</http-method>
       <http-method>POST</http-method>
     </web-resource-collection>
     <auth-constraint>
       <role-name>JBossAdmin</role-name>
     </auth-constraint>
   </security-constraint>

<login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>JBoss JMX Console</realm-name>
   </login-config>

<security-role>
      <role-name>JBossAdmin</role-name>
   </security-role>
</web-app>

1.1.2               web-console 安全设置

1.1.2.1          编辑jboss-web.xml文件

[jboss@node1 ~]$ cd JBOSS_HOME/server/default/deploy/management/console-mgr.sar/web-console.war
[jboss@node1 web-console.war]$ vi WEB-INF/jboss-web.xml
<!--将-->
<jboss-web>
   <!-- Uncomment the security-domain to enable security. You will need to edit the htmladaptor login nfiguration to setup thelogin modules used to authentication users.
   <security-domain>java:/jaas/web-console</security-domain>
   -->
  
   <!-- The war depends on the -->
   <depends>jboss.admin:service=PluginManager</depends>
</jboss-web>
<!--修改为-->
<jboss-web>
   <!-- Uncomment the security-domain to enable security. You will need to edit the htmladaptor login configuration to setup the login modules used to authentication users. -->
   <security-domain>java:/jaas/web-console</security-domain>

<!-- The war depends on the -->
   <depends>jboss.admin:service=PluginManager</depends>
</jboss-web>

 

1.1.2.2          编辑web.xml文件

u  编辑web-console.war/WEB-INF/web.xml文件:
[jboss@node1 web-console.war]$ vi WEB-INF/jboss-web.xml
<!--将-->
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
......
   <!-- A security constraint that restricts access to the HTML JMX console to users with the role JBossAdmin. Edit the roles to what you want and uncomment the WEB-INF/jboss-web.xml/security-domain element to enable secured access to the HTML JMX console.

<security-constraint>
   <web-resource-collection>
   <web-resource-name>HtmlAdaptor</web-resource-name>
   <description>An example security config that only allows users with the
   role JBossAdmin to access the HTML JMX console web application
   </description>
   <url-pattern>/*</url-pattern>
   <http-method>GET</http-method>
   <http-method>POST</http-method>
   </web-resource-collection>
   <auth-constraint>
   <role-name>JBossAdmin</role-name>
   </auth-constraint>
   </security-constraint>
   -->

<login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>JBoss WEB Console</realm-name>
   </login-config>

<security-role>
      <role-name>JBossAdmin</role-name>
   </security-role>
</web-app>
<!--修改为-->
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   ......

<!-- A security constraint that restricts access to the HTML JMX console to users with the role JBossAdmin. Edit the roles to what you want and uncomment the WEB-INF/jboss-web.xml/security-domain element to enable secured access to the HTML JMX console.-->

<security-constraint>
   <web-resource-collection>
   <web-resource-name>HtmlAdaptor</web-resource-name>
   <description>An example security config that only allows users with the
   role JBossAdmin to access the HTML JMX console web application
   </description>
   <url-pattern>/*</url-pattern>
   <http-method>GET</http-method>
   <http-method>POST</http-method>
   </web-resource-collection>
   <auth-constraint>
   <role-name>JBossAdmin</role-name>
   </auth-constraint>
   </security-constraint>

<login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>JBoss WEB Console</realm-name>
   </login-config>

<security-role>
      <role-name>JBossAdmin</role-name>
   </security-role>
</web-app>

[jboss@node1 ~]$ cd JBOSS_HOME/server/default/conf/props
[jboss@node1 props]$ ls jmx*
jmx-console-roles.properties jmx-console-users.properties

其中的jmx-console-roles.properties 是用户角色配置,而jmx-console-users.properties则是用户密码配置。
u  增加一个用户:
[jboss@node1 props]$ vi jmx-console-roles.properties
#将
# A sample roles.properties file for use with the UsersRolesLoginModule
admin=JBossAdmin,HttpInvoker
#修改为
admin=JBossAdmin,HttpInvoker
jboss=JBossAdmin,HttpInvoker

注意:配置文件里面左面的是用户,右面对应的是角色
u  为新增的用户设置密码:
[jboss@node1 props]$ vi jmx-console-users.properties
#将
# A sample users.properties file for use with the UsersRolesLoginModule
admin=admin
#修改为
admin=admin
jboss=jboss

注意:配置文件里面左面的是用户,右面对应的是密码

1.1.4               设置web-console帐户密码

1.2  JBoss其他重要的一些设置

1.2.1               JBoss集群名称修改

编辑JBOSS_HOME/server/YOURCONDIF/deploy/cluster-service.xml文件:
[jboss@node1 ~]$ vi JBOSS_HOME/server/YOURCONDIF
/deploy/cluster-service.xml
<!--将-->  
    
<mbean code="org.jboss.ha.framework.server.ClusterPartition"
      name="jboss:service=${jboss.partition.name:DefaultPartition}">
      <!-- Name of the partition being built -->
<attribute name="PartitionName">
${jboss.partition.name:DefaultPartition}</attribute>
         ......
      <depends>jboss:service=Naming</depends>
   </mbean>
<!--修改为-->

<mbean code="org.jboss.ha.framework.server.ClusterPartition"
      name="jboss:service=${jboss.partition.name:DefaultPartition}">
      <!-- Name of the partition being built -->
          <attribute name="PartitionName">你的集群的名字</attribute>
         ......
      <depends>jboss:service=Naming</depends>
   </mbean>

1.2.2               JBoss群集通讯协议

大型的JBoss集群使用UDP协议更好,可以减少网络流量。而对于小型的JBoss集群,使用TCP协议比较好,也比较安全。
编辑JBOSS_HOME/server/YOURCONDIF/deploy/cluster-service.xml文件:
[jboss@node1 ~]$ vi JBOSS_HOME/server/YOURCONDIF
/deploy/cluster-service.xml
<!--查找-->
<mbean code="org.jboss.ha.framework.server.ClusterPartition"
      name="jboss:service=${jboss.partition.name:DefaultPartition}"> 
......  
<Config>
<UDP mcast_addr="${jboss.partition.udpGroup:228.1.2.3}" mcast_port="45566"
ip_ttl="${jgroups.mcast.ip_ttl:8}" ip_mcast="true"
               mcast_recv_buf_size="2000000" mcast_send_buf_size="640000"
               ucast_recv_buf_size="2000000" ucast_send_buf_size="640000"
               loopback="false"/> 
   ......
</Config>
</mbean>
<!--修改为-->
<mbean code="org.jboss.ha.framework.server.ClusterPartition"
      name="jboss:service=${jboss.partition.name:DefaultPartition}"> 
  ......
<!--
<Config>
<UDP mcast_addr="${jboss.partition.udpGroup:228.1.2.3}" mcast_port="45566"
ip_ttl="${jgroups.mcast.ip_ttl:8}" ip_mcast="true"
               mcast_recv_buf_size="2000000" mcast_send_buf_size="640000"
               ucast_recv_buf_size="2000000" ucast_send_buf_size="640000"
               loopback="false"/> 
               ......
</Config>
-->
</mbean>
<!--查找-->
<mbean code="org.jboss.ha.framework.server.ClusterPartition"
      name="jboss:service=${jboss.partition.name:DefaultPartition}"> 
  ......
<!--
<Config>
<TCP bind_addr="thishost" start_port="7800" loopback="true"
                 recv_buf_size="2000000" send_buf_size="640000"
                 tcp_nodelay="true" up_thread="false" down_thread="false"/>
<TCPPING initial_hosts="thishost[7800],otherhost[7800]"  
port_range="3" timeout="3500"  num_initial_members="3"
up_thread="false" down_thread="false"/> 
               ......
</Config>
-->
</mbean>
<!--修改为-->
<mbean code="org.jboss.ha.framework.server.ClusterPartition"
      name="jboss:service=${jboss.partition.name:DefaultPartition}"> 
  ......
<Config>
<TCP bind_addr="thishost" start_port="7800" loopback="true"
                 recv_buf_size="2000000" send_buf_size="640000"
                 tcp_nodelay="true" up_thread="false" down_thread="false"/>
<TCPPING initial_hosts="thishost[7800],otherhost[7800]"  
port_range="3" timeout="3500"  num_initial_members="3"
up_thread="false" down_thread="false"/> 
               ......
</Config>
</mbean>

同时,将“thishost”换成本机IP,“otherhost”换成另一台JBoss集群节点的IP。例如:
<Config>
<TCP bind_addr="192.168.200.12" start_port="7800" loopback="true"
                 recv_buf_size="2000000" send_buf_size="640000"
                 tcp_nodelay="true" up_thread="false" down_thread="false"/>
<TCPPING initial_hosts="192.168.200.12 [7800], 192.168.200.13 [7800]"  
port_range="3" timeout="3500"  num_initial_members="3"
up_thread="false" down_thread="false"/> 
               ......
</Config>

1.2.3               JBoss字符集设置

JBoss启动时默认使用的是系统字符集,而某些应用程序对于系统默认的字符集会出现不兼容的情况,如:打印出来的数据都是乱码。对于这种情况,可以在JBoss启动时定制应用程序使用自己的字符集。
u 使用vi命令编辑JBOSS_HOME/bin/run.conf文件:
[jboss@node1 ~]$ vi JBOSS_HOME/bin/run.conf
#在文件的上部加入字符集(红色字体部分)
## -*- shell-script -*- ######################################################
##                                                                          ##
##  JBoss Bootstrap Script Configuration                                    ##
##                                                                          ##
##############################################################################

### $Id: run.conf 62747 2007-05-02 17:43:36Z dimitris@jboss.org $

#
# This file is optional; it may be removed if not needed.
#

#
# Specify the maximum file descriptor limit, use "max" or "maximum" to use
# the default, as queried by the system.
#
# Defaults to "maximum"
#
#MAX_FD="maximum"
export LANG="zh_CN.GBK"
#
# Specify the profiler configuration file to load.
#
# Default is to not load profiler configuration file.
#
#PROFILER=""

......

u  重新运行JBoss,乱码问题就可以解决了。
注意:上面的操作只是举个例子,字符集的修改需要根据实际情况而定。

转载于:https://blog.51cto.com/jxwpx/213311

Redhat(Linux)上的JBoss管理配置相关推荐

  1. redhat linux支持的文件系统,在RedHat Linux上使用LVM管理磁盘并创建文件系统

    在RedHat Linux上使用LVM管理磁盘并创建文件系统 一.组网需求: RedHat Linux AS 4 Update2,H3C Neocean系列存储产品 RedHat Linux AS 4 ...

  2. linux 管理mysql,Linux上MySQL的管理配置

    8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? 配置MySQL远程登陆 先登陆到MySQL服务 $ mysql -u root -p 然后选择使用mysql数据库 my ...

  3. 如何在 Linux 上安装服务器管理软件 Cockpit

    如何在 Linux 上安装服务器管理软件 Cockpit Cockpit 是一个自由开源的服务器管理软件,它使得我们可以通过它好看的 web 前端界面轻松地管理我们的 GNU/Linux 服务器.Co ...

  4. python tkinter linux,用于Python和Tkinter的Linux上的字体管理

    我已经在Python2.7/Tkinter中编写了一个应用程序. 我有2台Linux机器: 1 Xubuntu上与蟒蛇2.7.1(不幸的是,有人问之前,我不能将此机器升级)用于Python和Tkint ...

  5. linux nfs如何配置,Linux上的NFS如何配置?

    Linux上的NFS的配置方法如下: 1.安装NFS服务nfs和portmap.2.注意防火墙以及SElinux1)查看防火墙状态的方法[root@secDB1 ~]# service iptable ...

  6. 在RedHat Linux系统中安装和配置snmp服务

    在RedHat Linux系统中安装和配置snmp服务 检查系统是否安装snmp服务 # rpm -qa|grep snmp net-snmp-5.3.2.2-17.el5 net-snmp-perl ...

  7. 网卡或网络配置文件(Linux网络操作系统与管理配置)小红帽

    网卡或网络配置文件(Linux网络操作系统与管理配置)小红帽 1.ifconfig是一个用来查看启用禁用的网络接口工具 /etc/sysconfig/network-scripts/ifcfg-eth ...

  8. linux上用户管理,掌握Linux上的用户管理

    您是Linux管理员吗?您是否在Linux命令行中创建/删除用户?如果是,那么本文适合您!阅读以下内容后,您将能够在Linux系统中操纵用户和组权限.在下面的示例中,sai是用户名. 用户模组 use ...

  9. Docker在Linux上下载与安装配置

    Docker在Linux上下载与安装配置 官方文档: Redirecting- 1.删除旧版本的docker,防止有残留 sudo yum remove docker \docker-client \ ...

最新文章

  1. 与后台交互方法一 ——Ajax
  2. C/C++ 读取任意数目的整数
  3. 礼物——最牛午饭证!
  4. helloworld设置成开机自启动的服务
  5. 最全面的 python 字符串拼接总结(带注释版)
  6. GPU Gems2 - 8 使用距离函数的逐像素位移贴图
  7. 江西住建云实名认证怎么弄_王者荣耀无限时间怎么弄 2020年无限时间账号
  8. 物联网与人工智能之间的区别与联系
  9. VS项目打包,并自动安装SQL数据库
  10. 计算机三级网络技术总结,计算机三级网络技术总结
  11. Python数据库模块pymssql连接SQLServer数据库操作详解
  12. python中面向对象的ui_Python面向对象和图形用户界面(一)---- 面向对象
  13. mp2555sp文件服务器,理光mp2555sp驱动
  14. 调剂深圳大学计算机技术,深圳大学:2020年硕士研究生招生调剂办法公告
  15. ubuntu20.04截图快捷键
  16. 洛谷 P5144 蜈蚣
  17. react-native实现微信分享和微信支付(安卓端)
  18. [maya] 粒子系统之物体消散效果
  19. 程序员都是技术宅?他们完全刷新了我们对程序员的认知
  20. vive定位器突然闪红灯

热门文章

  1. RMAN备份学习笔记
  2. Tomcat启动与关闭事件监听
  3. Java web(2012/2/22)
  4. vue路由加载页面时,数据返回慢的问题
  5. 微软已停止对Vista RTM(SP0)的服务支持
  6. [] ubuntu 14.04 搜狗拼音输入法安装
  7. 安全小测试:介绍一个简单web安全知识测试的网站
  8. js 下拉框选中跳转
  9. 模糊搜索cell效果
  10. 《从零开始学Swift》学习笔记(Day 14)——字符串的插入、删除和替换