Automatically Restart Websphere Application Server (1)

Source: Internet
Author: User
Tags websphere application server

Automatic RestartApplicationServerNot necessarily everySystemRequired. Assume that a system application does not exist.MemoryLeakage, database connection leakage, and so on.

TheClusterTechnologyThis is sufficient to ensure the high availability of the system, because the cluster can perform load balancing and failover, even if one or two members of the Cluster stop theoretically and in a short timeBusinessIt will not cause too much impact.

Therefore, automatic restart of the Application Server is a proposition under special requirements and is not universal. One of the solutions and implementation methods is proposed here, which is for reference only.

I. background
AEnterpriseAs one of the core systems, application systems are deployed on backend database servers.SetThe number of database connections is thousands or even up to 5000,DevelopmentThe team performs code lookup on the core code andPerformanceTests are always unremitting, but they do not pay much attention to the application code with low usage frequency, and the urgent requirements for new development are not properly checked due to time constraints and performance tests, there may be hidden risks of Memory leakage and database connection holding and not releasing. The accumulation is much lower. After a few days, the pressure on the back-end database can be caused, and the number of database connections reaches or even exceeds the preset threshold value, in this case, the application server is not restarted, but the database is restarted. In this case, the action of the application server is much less influential than that of the database. Therefore, a special requirement for automatic restart of the application server is raised.

II,DesignIdeas
1. StopWas
1.1 read Enterprise Application ServerInstanceList. ReadServerList is a crucial step. Here, we use the serverstatus. Sh Command provided by was to obtain the server list. However. if the default Character Set of the operating system does not support Chinese characters, the semicolon, a separator similar to the server, has two completely different representations: Chinese full-byte (:) and English single-byte. How to skillfully construct a semicolon separator for processing full-width English and Chinese charactersSolutionKey issues.

The following are the default Supported languages for the operating system: English and Chinese.EnvironmentReal instance:
1.1.1 in a Chinese environment, the full-byte dual-byte (:) Semicolon is used as the delimiter:
[Root @ test1 bin] $ sh serverstatus. Sh-all
Admu0118e:LogsFile cannot be written to location
/Opt/IBM/WebSphere/appserver/logs/serverstatus. log; Use
-Logfile specifies different locations
Admu0503i: retrieving the server status of all servers
Admu0505i: Find the server in the Configuration:
Admu0506i: Server Name: Interface
Admu0506i: Server Name: nodeagent
Admu0506i: Server Name: test2web1
Admu0506i: Server Name: test2ejb1
Admu0506i: Server Name: webservicestest

1.1.2 in an English environment, a single byte (:) Semicolon is used as the delimiter:

[Root @ Test2 bin] $ sh serverstatus. Sh-all
Admu0118e: the log file cannot be written to location
/Opt/IBM/WebSphere/appserver/logs/serverstatus. log; please specify
Different location with-logfile
Admu0503i: Retrieving server status for all servers
Admu0505i: servers found in Configuration:
Admu0506i: Server Name: Interface
Admu0506i: Server Name: nodeagent
Admu0506i: Server Name: test1web1
Admu0506i: Server Name: test1ejb1
Admu0506i: Server Name: webservicestest

To solve the problem that the semicolon is a double byte of Chinese characters and a single byte of English characters, a feasible solution is provided as follows:
# Define the was installation path
Basepath = "/IBM/WebSphere/appserver"
# Retrieve the list of was server instances
Export rvlist = '$ basepath/bin/serverstatus. sh-All | SED's/admu0506i: // G' | grep-V nodeagent | SED's // G' | SED's /:/: /G' | awk-F': ''{ors =" "} {print $2 }''

The script command for getting the server list is described as follows:
A. Use the serverstatus. Sh-all command to obtain all;
B. Search for adaptive rows based on the keyword admu0506i;
C. filter out the nodeagent lines in the result set to prevent the nodeagent process from being accidentally stopped;
D. filter out a single-byte empty string ("") in the result set;
E. In the result set, replace the double-byte full-width semicolon (":") with a single-byte half-width semicolon (":");
F. Obtain the server Column Based on the uniform single-byte half-width semicolon as the separator, and then print the output Server LIST using spaces between servers.

1.2 stop Enterprise Application Server instances in turn. Use the stopserver. Sh command.

2. Start was
2.1 read the list of Enterprise Application Server instances.
2.2 start Enterprise Application Server instances in turn. Use the startserver. Sh command.

3. Set the automatic restart frequency and time
3.1 let the business decide the restart policy. In general, it is unlikely that the service will be shut down and self-initiated on a 7*24 basis without interruption. However, in the absence of a solution, business and IT departments can negotiate with each other to make certain compromises and concessions. For example, the restart frequency policy can be set to one week. the restart time policy is set to stop was at 06:05 a.m. and start was at 06:10 a.m.

3.2 set timed restart. In UNIX, you can set it through crontab. As mentioned above, the restart time for one week includes two time points: Self-stop and self-start. This is assumed to be 06:05 on Saturday and 06:10 on Saturday.
5 6 ** 6 command line
10 6 ** 6 command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.