Redhat(Linux)上的JBoss管理配置

简介:
Redhat(Linux)上的JBoss管理配置

 JBoss设置

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
<!--将--> 
< 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   编辑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文件

u   修改web-console.war/WEB-INF/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 >

1.1.3               设置jmx-console帐户密码

1.1.3.1          增加账户

u  进入 JBOSS_HOME/server/default/conf/props文件夹
[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帐户密码

    web-console的用户、角色、密码的设置与上面的jmx-console一致,只是配置文件web-console-roles.properties和web-console-users.properties的位置没有在上面的目录里,而是在JBOSS_HOME/server/default/deploy/management/
console-mgr.sar/web-console.war/WEB-INF/classes
的目录里。
    所以这里就不再重复上面的步骤,请读者自己进行操作。

1.2  JBoss其他重要的一些设置

1.2.1               JBoss集群名称修改

同一个网段内可能会有多个集群,所以要以集群的名字来区分它们。按照下面的方法修改 JBoss 集群的名字,使同一网段内的多个 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,乱码问题就可以解决了。
注意:上面的操作只是举个例子,字符集的修改需要根据实际情况而定。









本文转自 jxwpx 51CTO博客,原文链接:http://blog.51cto.com/jxwpx/213311,如需转载请自行联系原作者
目录
相关文章
|
15天前
|
安全 Ubuntu Java
Linux配置使用篇
Linux配置使用篇
|
14天前
|
Linux 网络安全
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
23 1
|
15天前
|
网络协议 Linux
在Linux中,管理和配置网络接口
在Linux中管理网络接口涉及多个命令,如`ifconfig`(在新版本中被`ip`取代)、`ip`(用于网络设备配置)、`nmcli`(NetworkManager的CLI工具)、`nmtui`(文本界面配置)、`route/ip route`(处理路由表)、`netstat/ss`(显示网络状态)和`hostnamectl/systemctl`(主机名和服务管理)。这些命令帮助用户启动接口、设置IP地址、查看连接和路由信息。不同发行版可能有差异,建议参考相应文档。
19 4
|
1天前
|
Ubuntu 网络协议 Linux
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
13 0
|
1天前
|
Linux
Linux(9)Debain EC25 quectel-CM usbnet0开机自动联网配置
Linux(9)Debain EC25 quectel-CM usbnet0开机自动联网配置
6 0
|
4天前
|
Linux 网络安全 开发工具
【GitLab私有仓库】在Linux上用Gitlab搭建自己的私有库并配置cpolar内网穿透
【GitLab私有仓库】在Linux上用Gitlab搭建自己的私有库并配置cpolar内网穿透
|
5天前
|
缓存 安全 Ubuntu
Linux配置代理上网
如何配置Linux代理
14 1
|
9天前
|
消息中间件 监控 Linux
Linux进程和计划任务管理
通过这些命令和工具,你可以有效地管理Linux系统中的进程和计划任务,监控系统的运行状态并保持系统的稳定和可靠性。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
101 2
|
15天前
|
存储 缓存 监控
Linux内存和硬盘空间管理技巧
了解Linux内存和硬盘管理技巧,提升系统性能和稳定性。使用`free`, `top`, `vmstat`监控内存,通过`sync`, `echo 1 &gt; /proc/sys/vm/drop_caches`清理缓存。利用Swap分区释放内存。借助`df`, `du`检查硬盘空间,清理无用文件,使用`clean-old`, `gzip`, `tar`压缩归档。查找大文件用`find`和`du`,确保
33 0
|
22天前
|
存储 固态存储 Unix
Linux中磁盘分区和文件系统管理
在Linux系统中,磁盘是存储数据的物理设备,如HDD或SSD,以文件形式存在于`/dev`目录下,如`sda`、`sdb`等。文件系统定义了如何在磁盘上组织和访问数据,常见的Linux文件系统有ext2、ext3、ext4、xfs等。通过虚拟机软件如VMware,用户可以向Linux虚拟机添加新的硬盘。