
ActiveMQ 安装windwos服务不能启动问题
一AcitveMQ windwos 服务
1安装目录下新建 temp文件夹
2安装目录下\bin\win32\wrapperconf指定javaiotempdir目录
wrapperjavaadditional10=-Djavaiotmpdir="%ACTIVEMQ_HOME%/temp"
# ------------------------------------
# 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 20
# (the "License"); you may not use this file except in compliance with
# the License You may obtain a copy of the License at
#
#
#
# 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
# ------------------------------------
#
# Wrapper Properties
#
#wrapperdebug=TRUE
setdefaultACTIVEMQ_HOME=/
setdefaultACTIVEMQ_BASE=/
wrapperworkingdir=
# Java Application
wrapperjavacommand=java
# Java Main class This class must implement the WrapperListener interface
# or guarantee that the WrapperManager class is initialized Helper
# classes are provided to do this for you See the Integration section
# of the documentation for details
wrapperjavamainclass=orgtanukisoftwarewrapperWrapperSimpleApp
# Java Classpath (include wrapperjar) Add class path elements as
# needed starting from 1
wrapperjavaclasspath1=%ACTIVEMQ_HOME%/bin/wrapperjar
wrapperjavaclasspath2=%ACTIVEMQ_HOME%/bin/runjar
# Java Library Path (location of WrapperDLL or libwrapperso)
wrapperjavalibrarypath1=%ACTIVEMQ_HOME%/bin/win32
# Java Additional Parameters
# note that n is the parameter number starting from 1
wrapperjavaadditional1=-Dactivemqhome="%ACTIVEMQ_HOME%"
wrapperjavaadditional2=-Dactivemqbase="%ACTIVEMQ_BASE%"
wrapperjavaadditional3=-DjavaxnetsslkeyStorePassword=password
wrapperjavaadditional4=-DjavaxnetssltrustStorePassword=password
wrapperjavaadditional5=-DjavaxnetsslkeyStore="%ACTIVEMQ_BASE%/conf/brokerks"
wrapperjavaadditional6=-DjavaxnetssltrustStore="%ACTIVEMQ_BASE%/conf/brokerts"
wrapperjavaadditional7=-Dcomsunmanagementjmxremote
wrapperjavaadditional8=-DorgapacheactivemqUseDedicatedTaskRunner=true
wrapperjavaadditional9=-Djavautilloggingconfigfile=loggingproperties
wrapperjavaadditional10=-Djavaiotmpdir="%ACTIVEMQ_HOME%/temp"
# Uncomment to enable remote jmx
#wrapperjavaadditionaln=-Dcomsunmanagementjmxremoteport=1616
#wrapperjavaadditionaln=-Dcomsunmanagementjmxremoteauthenticate=false
#wrapperjavaadditionaln=-Dcomsunmanagementjmxremotessl=false
# Uncomment to enable YourKit profiling
#wrapperjavaadditionaln=-Xrunyjpagent
# Uncomment to enable remote debugging
#wrapperjavaadditionaln=-Xdebug -Xnoagent -Djavacompiler=NONE
#wrapperjavaadditionaln=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
# Initial Java Heap Size (in MB)
#wrapperjavainitmemory=3
# Maximum Java Heap Size (in MB)
wrapperjavamaxmemory=512
# Application parameters Add parameters as needed starting from 1
wrapperappparameter1=orgapacheactivemqconsoleMain
wrapperappparameter2=start
#
# Wrapper Logging Properties
#
# Format of output for the console (See docs for formats)
wrapperconsoleformat=PM
# Log Level for console output (See docs for log levels)
wrapperconsoleloglevel=INFO
# Log file to use for wrapper output logging
wrapperlogfile=%ACTIVEMQ_BASE%/data/wrapperlog
# Format of output for the log file (See docs for formats)
wrapperlogfileformat=LPTM
# Log Level for log file output (See docs for log levels)
wrapperlogfileloglevel=INFO
# Maximum size that the log file will be allowed to grow to before
# the log is rolled Size is specified in bytes The default value
# of 0, disables log rolling May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix For example: 10m = 10 megabytes
wrapperlogfilemaxsize=0
# Maximum number of rolled log files which will be allowed before old
# files are deleted The default value of 0 implies no limit
wrapperlogfilemaxfiles=0
# Log Level for sys/event log output (See docs for log levels)
wrappersyslogloglevel=NONE
#
# Wrapper Windows Properties
#
# Title to use when running as a console
wrapperconsoletitle=ActiveMQ
#
# Wrapper Windows NT/2000/XP Service Properties
#
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service
# Please uninstall the service before modifying this section The
# service can then be reinstalled
# Name of the service
wrapperntservicename=ActiveMQ
# Display name of the service
wrapperntservicedisplayname=ActiveMQ
# Description of the service
wrapperntservicedescription=ActiveMQ Broker
# Service dependencies Add dependencies as needed starting from 1
wrapperntservicedependency1=
# Mode in which the service is installed AUTO_START or DEMAND_START
wrapperntservicestarttype=AUTO_START
# Allow the service to interact with the desktop
wrapperntserviceinteractive=false
4出现如下错误 Unable to execute Java command 系统找不到指定的文件。 (0x2)
5指定Java安装路径
wrapperjavacommand=C:/Program Files/Java/jdk170_25/bin/java
# ------------------------------------
# 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 20
# (the "License"); you may not use this file except in compliance with
# the License You may obtain a copy of the License at
#
#
#
# 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
# ------------------------------------
#
# Wrapper Properties
#
# wrapperdebug=TRUE
setdefaultACTIVEMQ_HOME=/
setdefaultACTIVEMQ_BASE=/
wrapperworkingdir=
# Java Application
wrapperjavacommand=C:/Program Files/Java/jdk170_25/bin/java
# Java Main class This class must implement the WrapperListener interface
# or guarantee that the WrapperManager class is initialized Helper
# classes are provided to do this for you See the Integration section
# of the documentation for details
wrapperjavamainclass=orgtanukisoftwarewrapperWrapperSimpleApp
# Java Classpath (include wrapperjar) Add class path elements as
# needed starting from 1
wrapperjavaclasspath1=%ACTIVEMQ_HOME%/bin/wrapperjar
wrapperjavaclasspath2=%ACTIVEMQ_HOME%/bin/runjar
# Java Library Path (location of WrapperDLL or libwrapperso)
wrapperjavalibrarypath1=%ACTIVEMQ_HOME%/bin/win32
# Java Additional Parameters
# note that n is the parameter number starting from 1
wrapperjavaadditional1=-Dactivemqhome="%ACTIVEMQ_HOME%"
wrapperjavaadditional2=-Dactivemqbase="%ACTIVEMQ_BASE%"
wrapperjavaadditional3=-DjavaxnetsslkeyStorePassword=password
wrapperjavaadditional4=-DjavaxnetssltrustStorePassword=password
wrapperjavaadditional5=-DjavaxnetsslkeyStore="%ACTIVEMQ_BASE%/conf/brokerks"
wrapperjavaadditional6=-DjavaxnetssltrustStore="%ACTIVEMQ_BASE%/conf/brokerts"
wrapperjavaadditional7=-Dcomsunmanagementjmxremote
wrapperjavaadditional8=-DorgapacheactivemqUseDedicatedTaskRunner=true
wrapperjavaadditional9=-Djavautilloggingconfigfile=loggingproperties
wrapperjavaadditional10=-Djavaiotmpdir="%ACTIVEMQ_HOME%/temp"
# Uncomment to enable remote jmx
#wrapperjavaadditionaln=-Dcomsunmanagementjmxremoteport=1616
#wrapperjavaadditionaln=-Dcomsunmanagementjmxremoteauthenticate=false
#wrapperjavaadditionaln=-Dcomsunmanagementjmxremotessl=false
# Uncomment to enable YourKit profiling
#wrapperjavaadditionaln=-Xrunyjpagent
# Uncomment to enable remote debugging
#wrapperjavaadditionaln=-Xdebug -Xnoagent -Djavacompiler=NONE
#wrapperjavaadditionaln=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
# Initial Java Heap Size (in MB)
#wrapperjavainitmemory=3
# Maximum Java Heap Size (in MB)
Resin配置优化
1 Resin安装及自启动设置
创建开机自动启动
cp contrib/initresin /etc/rcd/initd/resin
vi /etc/rcd/initd/resin
设置正确的路径
JAVA_HOME=/usr/local/jdk160_13
RESIN_HOME=/usr/local/resin-318
赋予可执行权限
chmod +x /etc/rcd/initd/resin
加为自启动服务:
chkconfig --add resin
chkconfig --level 35 resin on
service resin start
解决启动服务错误: log_daemon_msg: command not found
将该函数调用到的地方注释掉并用echo 来代替。如:
log_daemon_msg “resin start”
改为
echo “resin start”
修改好后可以用service resin start/stop/restart来执行相关的命令。
2 设置resinconf参数及JVM设置
<jvm-arg>-Xmx4096m</jvm-arg>
<jvm-arg>-Xms4096m</jvm-arg>
<jvm-arg>-Xmn512M</jvm-arg>
<jvm-arg>-Xss50M</jvm-arg>
<jvm-arg>-XX:PermSize=768M</jvm-arg>
<jvm-arg>-XX:MaxPermSize=768M</jvm-arg>
<jvm-arg>-XX:SurvivorRatio=8</jvm-arg>
<jvm-arg>-XX:MaxTenuringThreshold=7</jvm-arg>
<jvm-arg>-XX:GCTimeRatio=19</jvm-arg>
<jvm-arg>-XX:+UseParNewGC</jvm-arg>
<jvm-arg>-XX:+UseConcMarkSweepGC</jvm-arg>
<jvm-arg>-XX:+CMSPermGenSweepingEnabled</jvm-arg>
<jvm-arg>-XX:+CMSClassUnloadingEnabled</jvm-arg>
<jvm-arg>-XX:+UseCMSCompactAtFullCollection</jvm-arg>
<jvm-arg>-XX:CMSFullGCsBeforeCompaction=2</jvm-arg>
<jvm-arg>-XX:-CMSParallelRemarkEnabled</jvm-arg>
<jvm-arg>-XX:+DisableExplicitGC</jvm-arg>
<jvm-arg>-XX:CMSInitiatingOccupancyFraction=70</jvm-arg>
<jvm-arg>-XX:SoftRefLRUPolicyMSPerMB=0</jvm-arg>
<jvm-arg>-XX:+PrintClassHistogram</jvm-arg>
<jvm-arg>-XX:+PrintGCDetails</jvm-arg>
<jvm-arg>-XX:+PrintGCTimeStamps</jvm-arg> <jvm-arg>-XX:+PrintGCApplicationConcurrentTime</jvm-arg>
<jvm-arg>-XX:+PrintGCApplicationStoppedTime</jvm-arg>
<jvm-arg>-Xloggc:log/gclog</jvm-arg>
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremote</jvm-arg>
内存设置配置:
<memory-free-min>5M</memory-free-min>
最大线程数
<!-- Maximum number of threads -->
<thread-max>1024</thread-max>
<!-- Configures the socket timeout -->
<socket-timeout>65s</socket-timeout>
配置最活连接和超时时间
<!-- Configures the keepalive -->
<keepalive-max>2048</keepalive-max>
keepalive-timeout>15s</keepalive-timeout>
3 配置jconsole监控JVM
$JAVA_HOME/jre/lib/management/jmxremotepasswordtemplate的文件是远程连接时的设置用户和密码的文件,
cp $JAVA_HOME/jre/lib/management/jmxremotepasswordtemplate $JAVA_HOME/jconsole/jmxremotepassword
chmod 600 $JAVA_HOME/jconsole/jmxremotepassword
vi jmxremotepassword
去掉#monitorRole RED前的注释并将RED修改为你要设置的密码。在resinconf加入以下配置,其中被监控主机的IP需要和主机IP一致
<jvm-arg>-Dcomsunmanagementjmxremoteport=12345</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremotessl=false</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremoteaccessfile=/usr/local/jdk160_13/jre/lib/management/jmxremoteaccess</jvm-arg> <jvm-arg>-Dcomsunmanagementjmxremotepasswordfile=/usr/local/jdk160_13/jre/lib/management/jmxremotepassword</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremoteauthenticate=true</jvm-arg>
<jvm-arg>-Djavarmiserverhostname=1921681009</jvm-arg>
在客户端基本不用怎么设置,在 JDK 安装目录中(<JDK_HOME>/bin/jconsoleexe)启动 jconsoleexe 就可以打开主界面。输入1921681009:12345 用户名和密码即可看到监控界面中关于jvm的相关信息。 *** 作
双击jconsoleexe启动连接对话框
4 配置Resin后台管理
<management path="${resinroot}/admin">
<user name="admin" password="MnHpobDOvrMOyQFWoa5w7A=="/>
<resin:if test="${resinprofessional}">
<deploy-service/>
<jmx-service/>
<log-service/>
<xa-log-service/>
</resin:if>
</management>
<web-app id="/resin-admin" root-directory="${resinhome}/php/admin">
<!--
- Administration application /resin-admin-->
<prologue>
<resin:set var="resin_admin_user" value="admin"/>
<resin:set var="resin_admin_password" value="password"/>
<resin:set var="resin_admin_external" value="true"/>
<resin:set var="resin_admin_insecure" value="true"/>
</prologue>
</web-app>
二 网络优化部分
1 减少TCP连接中的TIME-WAIT或 CLOSE-WAIT包
Vim /etc/sysctlconf加入以下配置
netipv4tcp_syncookies = 1
netipv4tcp_tw_reuse = 1
netipv4tcp_tw_recycle = 1
netipv4tcp_fin_timeout = 15
netipv4tcp_keepalive_time = 1200
netipv4tcp_keepalive_probes = 5
netipv4tcp_keepalive_intvl = 15
配置属性说明:
netipv4tcp_syncookies = 1 表示开启SYN Cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭;
netipv4tcp_tw_reuse = 1 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
netipv4tcp_tw_recycle = 1 表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭。
tcp_syn_retries :INTEGER
默认值是5
对于一个新建连接,内核要发送多少个 SYN 连接请求才决定放弃。不应该大于255,默认值是5,对应于180秒左右时间。(对于大负载而物理通信良好的网络而言,这个值偏高,可修改为2这个值仅仅是针对对外的连接,对进来的连接,是由tcp_retries1 决定的)
tcp_synack_retries :INTEGER
默认值是5
对于远端的连接请求SYN,内核会发送SYN + ACK数据报,以确认收到上一个 SYN连接请求包。这是所谓的三次握手( threeway handshake)机制的第二个步骤。这里决定内核在放弃连接之前所送出的 SYN+ACK 数目。不应该大于255,默认值是5,对应于180秒左右时间。(可以根据上面的 tcp_syn_retries 来决定这个值)
tcp_keepalive_time :INTEGER
默认值是7200(2小时)
当keepalive打开的情况下,TCP发送keepalive消息的频率。(由于目前网络攻击等因素,造成了利用这个进行的攻击很频繁,曾经也有cu的朋友提到过,说如果2边建立了连接,然后不发送任何数据或者rst/fin消息,那么持续的时间是不是就是2小时,空连接攻击 tcp_keepalive_time就是预防此情形的我个人在做nat服务的时候的修改值为1800秒)
tcp_keepalive_probes:INTEGER
默认值是9
TCP发送keepalive探测以确定该连接已经断开的次数。(注意:保持连接仅在SO_KEEPALIVE套接字选项被打开是才发送次数默认不需要修改,当然根据情形也可以适当地缩短此值设置为5比较合适)
tcp_keepalive_intvl:INTEGER
默认值为75
探测消息发送的频率,乘以tcp_keepalive_probes就得到对于从开始探测以来没有响应的连接杀除的时间。默认值为75秒,也就是没有活动的连接将在大约11分钟以后将被丢弃。(对于普通应用来说,这个值有一些偏大,可以根据需要改小特别是web类服务器需要改小该值,15是个比较合适的值)
再执行以下命令,让修改结果立即生效:/sbin/sysctl -p
用以下语句看了一下服务器的TCP状态:
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
三 解决Too many open files问题
Too many open files 问题出现有两种情况:
一种是在搜索的时候出现,多半是由于索引创建完毕之后被移动过,如果创建索引的时候不出现该错误,搜索的时候也一般是不会出现的。如果出现了,有两种处理办法,一种是修改合并因子和最小合并因子,并且使用
IndexWriterOptimize() 优化索引,这样会将索引文件数量减少到文件系统限制之内;另外一种办法是修改 *** 作系统的打开文件数量限制。方法如下:
按照最大打开文件数量的需求设置系统, 并且通过检查/proc/sys/fs/file-max文件来确认最大打开文件数已经被正确设置。 配置 *** 作如下:
# cat /proc/sys/fs/file-max
如果设置值太小, 修改文件/etc/sysctlconf的变量到合适的值。 这样会在每次重启之后生效。
# echo 65535 > /proc/sys/fs/file-max
编辑文件/etc/sysctlconf,插入下行。
fsfile-max = 65535
执行sysctl –p生效
设置ulimit –n 65535
在/etc/security/limitsconf文件中设置最大打开文件数, 下面是一行提示:
#
添加如下这行。
- nofile 65535
这行设置了每个用户的默认打开文件数为2048。 注意"nofile"项有两个可能的限制措施。就是项下的hard和soft。 要使修改过得最大打开文件数生效,必须对这两种限制进行设定。 如果使用"-"字符设定, 则hard和soft设定会同时被设定。
硬限制表明soft限制中所能设定的最大值。 soft限制指的是当前系统生效的设置值。 hard限制值可以被普通用户降低。但是不能增加。 soft限制不能设置的比hard限制更高。 只有root用户才能够增加hard限制值。
当增加文件限制描述,可以简单的把当前值双倍。 例子如下, 如果你要提高默认值1024, 最好提高到2048, 如果还要继续增加, 就需要设置成4096。
另外一种情况是在创建索引的时候,也有两种可能,一种是合并因子太小,导致创建文件数量超过 *** 作系统限制,这时可以修改合并因子,也可以修改 *** 作系统的打开文件数限制;另外一种是合并因子受虚拟机内存的限制,无法调整到更大,而 需要索引的doc 数量又非常的大,这个时候就只能通过修改 *** 作系统的打开文件数限制来解决了。
在系统访问高峰时间以root用户执行以下的脚本,可能出现的结果如下:
# lsof -n|awk '{print $2}'|sort|uniq -c |sort -nr|more
131 24204
57 24244
其中第一行是打开的文件句柄数量,第二行是进程号。得到进程号后,我们可以通过ps命令得到进程的详细内容。
ps -aef|grep 24204
mysql 24204 24162 99 16:15 00:24:25 /usr/sbin/mysqld
系统默认程打开最多文件句柄数值1024。但是如果系统并发特别大,尤其是squid服务器,很有可能会超过1024。这时候就必须要调整系统参数,以适应应用变化。Linux有硬性限制和软性限制。可以通过ulimit来设定这两个参数。方法如下,以root用户运行以下命令:
ulimit -HSn 4096 以上命令中,H指定了硬性大小,S指定了软性大小,n表示设定单个进程最大的打开文件句柄数量。设定句柄数量后,系统重启后,又会恢复默认值。如果想永久保存下来, /etc/security/limitsconf
string s = "abxgjmp2a3bjmx5abx";
s= sSubstring(sIndexOf("abx") + 3, sLastIndexOf("abx") - sIndexOf("abx")-3);
MessageBoxShow(s);
1 Resin安装及自启动设置
创建开机自动启动
cp contrib/initresin /etc/rcd/initd/resin
vi /etc/rcd/initd/resin
设置正确的路径
JAVA_HOME=/usr/local/jdk160_13
RESIN_HOME=/usr/local/resin-318
赋予可执行权限
chmod +x /etc/rcd/initd/resin
加为自启动服务:
chkconfig --add resin
chkconfig --level 35 resin on
service resin start
解决启动服务错误: log_daemon_msg: command not found
将该函数调用到的地方注释掉并用echo 来代替。如:
log_daemon_msg “resin start”
改为
echo “resin start”
修改好后可以用service resin start/stop/restart来执行相关的命令。
2 设置resinconf参数及JVM设置
<jvm-arg>-Xmx4096m</jvm-arg>
<jvm-arg>-Xms4096m</jvm-arg>
<jvm-arg>-Xmn512M</jvm-arg>
<jvm-arg>-Xss50M</jvm-arg>
<jvm-arg>-XX:PermSize=768M</jvm-arg>
<jvm-arg>-XX:MaxPermSize=768M</jvm-arg>
<jvm-arg>-XX:SurvivorRatio=8</jvm-arg>
<jvm-arg>-XX:MaxTenuringThreshold=7</jvm-arg>
<jvm-arg>-XX:GCTimeRatio=19</jvm-arg>
<jvm-arg>-XX:+UseParNewGC</jvm-arg>
<jvm-arg>-XX:+UseConcMarkSweepGC</jvm-arg>
<jvm-arg>-XX:+CMSPermGenSweepingEnabled</jvm-arg>
<jvm-arg>-XX:+CMSClassUnloadingEnabled</jvm-arg>
<jvm-arg>-XX:+UseCMSCompactAtFullCollection</jvm-arg>
<jvm-arg>-XX:CMSFullGCsBeforeCompaction=2</jvm-arg>
<jvm-arg>-XX:-CMSParallelRemarkEnabled</jvm-arg>
<jvm-arg>-XX:+DisableExplicitGC</jvm-arg>
<jvm-arg>-XX:CMSInitiatingOccupancyFraction=70</jvm-arg>
<jvm-arg>-XX:SoftRefLRUPolicyMSPerMB=0</jvm-arg>
<jvm-arg>-XX:+PrintClassHistogram</jvm-arg>
<jvm-arg>-XX:+PrintGCDetails</jvm-arg>
<jvm-arg>-XX:+PrintGCTimeStamps</jvm-arg> <jvm-arg>-XX:+PrintGCApplicationConcurrentTime</jvm-arg>
<jvm-arg>-XX:+PrintGCApplicationStoppedTime</jvm-arg>
<jvm-arg>-Xloggc:log/gclog</jvm-arg>
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremote</jvm-arg>
内存设置配置:
<memory-free-min>5M</memory-free-min>
最大线程数
<!-- Maximum number of threads -->
<thread-max>1024</thread-max>
<!-- Configures the socket timeout -->
<socket-timeout>65s</socket-timeout>
配置最活连接和超时时间
<!-- Configures the keepalive -->
<keepalive-max>2048</keepalive-max>
keepalive-timeout>15s</keepalive-timeout>
3 配置jconsole监控JVM
$JAVA_HOME/jre/lib/management/jmxremotepasswordtemplate的文件是远程连接时的设置用户和密码的文件,
cp $JAVA_HOME/jre/lib/management/jmxremotepasswordtemplate $JAVA_HOME/jconsole/jmxremotepassword
chmod 600 $JAVA_HOME/jconsole/jmxremotepassword
vi jmxremotepassword
去掉#monitorRole RED前的注释并将RED修改为你要设置的密码。在resinconf加入以下配置,其中被监控主机的IP需要和主机IP一致
<jvm-arg>-Dcomsunmanagementjmxremoteport=12345</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremotessl=false</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremoteaccessfile=/usr/local/jdk160_13/jre/lib/management/jmxremoteaccess</jvm-arg> <jvm-arg>-Dcomsunmanagementjmxremotepasswordfile=/usr/local/jdk160_13/jre/lib/management/jmxremotepassword</jvm-arg>
<jvm-arg>-Dcomsunmanagementjmxremoteauthenticate=true</jvm-arg>
<jvm-arg>-Djavarmiserverhostname=1921681009</jvm-arg>
在客户端基本不用怎么设置,在 JDK 安装目录中(<JDK_HOME>/bin/jconsoleexe)启动 jconsoleexe 就可以打开主界面。输入1921681009:12345 用户名和密码即可看到监控界面中关于jvm的相关信息。 *** 作
双击jconsoleexe启动连接对话框
4 配置Resin后台管理
<management path="${resinroot}/admin">
<user name="admin" password="MnHpobDOvrMOyQFWoa5w7A=="/>
<resin:if test="${resinprofessional}">
<deploy-service/>
<jmx-service/>
<log-service/>
<xa-log-service/>
</resin:if>
</management>
<web-app id="/resin-admin" root-directory="${resinhome}/php/admin">
<!--
- Administration application /resin-admin-->
<prologue>
<resin:set var="resin_admin_user" value="admin"/>
<resin:set var="resin_admin_password" value="password"/>
<resin:set var="resin_admin_external" value="true"/>
<resin:set var="resin_admin_insecure" value="true"/>
</prologue>
</web-app>
二 网络优化部分
1 减少TCP连接中的TIME-WAIT或 CLOSE-WAIT包
Vim /etc/sysctlconf加入以下配置
netipv4tcp_syncookies = 1
netipv4tcp_tw_reuse = 1
netipv4tcp_tw_recycle = 1
netipv4tcp_fin_timeout = 15
netipv4tcp_keepalive_time = 1200
netipv4tcp_keepalive_probes = 5
netipv4tcp_keepalive_intvl = 15
配置属性说明:
netipv4tcp_syncookies = 1 表示开启SYN Cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭;
netipv4tcp_tw_reuse = 1 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
netipv4tcp_tw_recycle = 1 表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭。
tcp_syn_retries :INTEGER
默认值是5
对于一个新建连接,内核要发送多少个 SYN 连接请求才决定放弃。不应该大于255,默认值是5,对应于180秒左右时间。(对于大负载而物理通信良好的网络而言,这个值偏高,可修改为2这个值仅仅是针对对外的连接,对进来的连接,是由tcp_retries1 决定的)
tcp_synack_retries :INTEGER
默认值是5
对于远端的连接请求SYN,内核会发送SYN + ACK数据报,以确认收到上一个 SYN连接请求包。这是所谓的三次握手( threeway handshake)机制的第二个步骤。这里决定内核在放弃连接之前所送出的 SYN+ACK 数目。不应该大于255,默认值是5,对应于180秒左右时间。(可以根据上面的 tcp_syn_retries 来决定这个值)
tcp_keepalive_time :INTEGER
默认值是7200(2小时)
当keepalive打开的情况下,TCP发送keepalive消息的频率。(由于目前网络攻击等因素,造成了利用这个进行的攻击很频繁,曾经也有cu的朋友提到过,说如果2边建立了连接,然后不发送任何数据或者rst/fin消息,那么持续的时间是不是就是2小时,空连接攻击 tcp_keepalive_time就是预防此情形的我个人在做nat服务的时候的修改值为1800秒)
tcp_keepalive_probes:INTEGER
默认值是9
TCP发送keepalive探测以确定该连接已经断开的次数。(注意:保持连接仅在SO_KEEPALIVE套接字选项被打开是才发送次数默认不需要修改,当然根据情形也可以适当地缩短此值设置为5比较合适)
tcp_keepalive_intvl:INTEGER
默认值为75
探测消息发送的频率,乘以tcp_keepalive_probes就得到对于从开始探测以来没有响应的连接杀除的时间。默认值为75秒,也就是没有活动的连接将在大约11分钟以后将被丢弃。(对于普通应用来说,这个值有一些偏大,可以根据需要改小特别是web类服务器需要改小该值,15是个比较合适的值)
再执行以下命令,让修改结果立即生效:/sbin/sysctl -p
用以下语句看了一下服务器的TCP状态:
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
三 解决Too many open files问题
Too many open files 问题出现有两种情况:
一种是在搜索的时候出现,多半是由于索引创建完毕之后被移动过,如果创建索引的时候不出现该错误,搜索的时候也一般是不会出现的。如果出现了,有两种处理办法,一种是修改合并因子和最小合并因子,并且使用
IndexWriterOptimize() 优化索引,这样会将索引文件数量减少到文件系统限制之内;另外一种办法是修改 *** 作系统的打开文件数量限制。方法如下:
按照最大打开文件数量的需求设置系统, 并且通过检查/proc/sys/fs/file-max文件来确认最大打开文件数已经被正确设置。 配置 *** 作如下:
# cat /proc/sys/fs/file-max
如果设置值太小, 修改文件/etc/sysctlconf的变量到合适的值。 这样会在每次重启之后生效。
# echo 65535 > /proc/sys/fs/file-max
编辑文件/etc/sysctlconf,插入下行。
fsfile-max = 65535
执行sysctl –p生效
设置ulimit –n 65535
在/etc/security/limitsconf文件中设置最大打开文件数, 下面是一行提示:
#
添加如下这行。
- nofile 65535
这行设置了每个用户的默认打开文件数为2048。 注意"nofile"项有两个可能的限制措施。就是项下的hard和soft。 要使修改过得最大打开文件数生效,必须对这两种限制进行设定。 如果使用"-"字符设定, 则hard和soft设定会同时被设定。
硬限制表明soft限制中所能设定的最大值。 soft限制指的是当前系统生效的设置值。 hard限制值可以被普通用户降低。但是不能增加。 soft限制不能设置的比hard限制更高。 只有root用户才能够增加hard限制值。
当增加文件限制描述,可以简单的把当前值双倍。 例子如下, 如果你要提高默认值1024, 最好提高到2048, 如果还要继续增加, 就需要设置成4096。
另外一种情况是在创建索引的时候,也有两种可能,一种是合并因子太小,导致创建文件数量超过 *** 作系统限制,这时可以修改合并因子,也可以修改 *** 作系统的打开文件数限制;另外一种是合并因子受虚拟机内存的限制,无法调整到更大,而 需要索引的doc 数量又非常的大,这个时候就只能通过修改 *** 作系统的打开文件数限制来解决了。
在系统访问高峰时间以root用户执行以下的脚本,可能出现的结果如下:
# lsof -n|awk '{print $2}'|sort|uniq -c |sort -nr|more
131 24204
57 24244
其中第一行是打开的文件句柄数量,第二行是进程号。得到进程号后,我们可以通过ps命令得到进程的详细内容。
ps -aef|grep 24204
mysql 24204 24162 99 16:15 00:24:25 /usr/sbin/mysqld
系统默认程打开最多文件句柄数值1024。但是如果系统并发特别大,尤其是squid服务器,很有可能会超过1024。这时候就必须要调整系统参数,以适应应用变化。Linux有硬性限制和软性限制。可以通过ulimit来设定这两个参数。方法如下,以root用户运行以下命令:
ulimit -HSn 4096 以上命令中,H指定了硬性大小,S指定了软性大小,n表示设定单个进程最大的打开文件句柄数量。设定句柄数量后,系统重启后,又会恢复默认值。如果想永久保存下来, /etc/security/limitsconf
以上就是关于启动activeMQ报错,每次重启电脑好几次才能启动MQ,该怎么解决全部的内容,包括:启动activeMQ报错,每次重启电脑好几次才能启动MQ,该怎么解决、如何配置resin 3.1.9、C#字符串 如何获取abxgjmp2a3bjmx5abx中abx之间的字符串等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)