Tuesday, January 29, 2019

Start service on Operating system on boot time - chkconfig/systemctl command




These are Linux commands to deal with services running for different apps on operating system. By the use of systemctl and chkconfig command, we can start and stop the services as well as configure them for auto start/stop in unix.


Basically above commands or tools allows you to configure automatic service start stop in the /etc/init.d scripts available on operating systems. Until RHEL 6.x, "chkconfig " command was available and later RHEL 7, the command "systemctl" introduced for auto service start/stop. although all legacy commands may support in new versions of RHEL and CentOS.


List All Services

  By Chkconfig command, list all the services on
[root@aps ~]# chkconfig  --list
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
rhnsd           0:off   1:off   2:off   3:on    4:off   5:on    6:off
netconsole      0:off   1:off   2:off   3:on    4:off   5:on    6:off
...
Above snippet shows different run level by numbering and post fixes.

By Systemctl, all active services and all enabled/disabled services
[root@aps ~]# systemctl list-units --type service
[root@aps ~]# systemctl list-unit-files --type service
Check Specific Service Status
[root@aps ~]# chkconfig --list | grep httpd
httpd           0:off   1:off   2:off   3:on   4:on   5:on   6:off
[root@aps ~]# systemctl list-units --type service | grep httpd
Stop Specific Service on Run Levels

Below command will stop httpd service at run level 2,3,4,5.
[root@aps ~]# chkconfig --level 2345 httpd off
Start/Stop Specific Service by systemctl
[root@aps ~]# systemctl stop [service_name]
[root@aps ~]# systemctl start [service_name]
Check Status of a Service by systemctl
[root@aps ~]# systemctl status [service_name]

How to Auto Start a Service at Boot of Operating System



By chkconfig command, below will stop httpd service at run level 4,5.
[root@aps ~]# chkconfig --level 45 httpd off

By systemctl command, you can enable any of service to start on boot time as below
[root@aps ~]# systemctl enable [service_name]
[root@aps ~]# systemctl disable [service_name]


_________________________________________________________________________________



Remove 7 days older log files from Unix server




This is the basic task in application support that requires log files to remove, back up to other location that are older than "N" days or let suppose 7 days from system date.

Sometimes requirement may ask you to run this task automatically on specified day, date and time to check on system file system, then you may use below commands in cron schedule on UNIX by making a script and set with schedule on crontab.




  • find the log files that are older than "n" days and remove all ? write the command plz....
           $ find   <path-to-check>  -name *.log -mtime  +n   -exec rm -rf {}\;
          Here <path-to-check> is server location or path to check and "+n" shows days.   * is wild card            to check all log files having extension .log
          Example :
          $ find   /tmp/logs  -name *.log -mtime  +7   -exec rm -rf {}\;
          Above will remove all log files older than 7 days.

Apache Web Server basic support Questions




  • Start & Stop of Apache web Server
             $  ./apachectl stop
             $  ./apachectl start 

              you may use scripts located at /etc/init.d/ mostly it will be "apache" or "httpd"
             $  /etc/init.d/apache   -start
             $  /etc/init.d/apache   -stop
                                   
                                                     "OR"
             $  /etc/init.d/httpd   -start

             $  /etc/init.d/httpd   -stop


  • Start/stop Apache web server as a OS service
             $ httpd stop
             $ service httpd start

  • Default Ports for Apache
              HTTP/HTTPS   -    80/443

  • How to check version of Apache web server
            $  ./httpd  -v          (in bin folder of installation)
            OR -    rpm -qa | grep httpd

  • How to check listen address of Apache 
          Open httpd.conf file and search for "Listen" string it will tell you the listen IP address and port
          Example :        Listen   10.10.10.10:80
  • Apache Web Server main configuration file
            httpd.conf        

  • How to check Apache web server is running ?
           by checking running process on Unix,    $ ps -aef | grep "httpd"



________________________________________________________________________________










Monday, January 28, 2019

What is JBOSS Application Server EAP & Wildfly





JBOSS BASICS



Q.  What is JBOSS?

  •          Jboss is a enterprises level application server that is available in enterprise and community version or open source. RedHat is the proprietary company for JBOSS EAP versions and driving it community version with name of Wildfly now. Earlier Jboss community version was available with Jboss AS x.x.x name.


  •          Now a days Jboss is hot in market, because it is providing enterprise level of support for application with lower cost compare to Oracle weblogic and IBM Websphere application server. And its big advantage is Open source.


  •          Jboss provided standalone installation on all operating systems as well as provide clustering support in production environment.


  •          JGroups toolkits are used in Jboss to create nodes, delete and membership detection with notification.


  •         Wildfly version 8 launched in Nov 2014 whereas Jboss EAP is for Enterprises.


  •         Jboss is available for both Windows and Linux environment.


  •         Default Admin console for Jboss

          http://<Server_IP>:9990/admin-console     (Here default port for Jboss console is 9990.)







Apache Server installation


Apache 2.4.9 Installation Steps for Linux Platform


Apache HTTP server 2.4.9  or Apache Web server is a new version of web-server developed by Apache Software Foundation and the Apache HTTP server project. This release Apache HTTP Server version 2.4.9 is currently stable version Apache HTTP server that represents fifteen years of research and development of Apache Foundation.
This httpd version contains new features like MPMs, mod_lua, better authentication & authorization, Fast CGI Proxy, improved OCSP support and small caching API.
Pre-Requisites for Apache 2.4.9 Version 
  • Operation System 
  • User access on the Linux box by which you want to install
  • Default port 80 should be open on the box to perform the installation
  • Check the sufficient memory space under the installation directory
  • Browser to check the server availability after installation

Main thing Apache HTTP Server installer files according to your OS :-

Stable Release - with Latest Version


Download File on your desktop :-  Apache HTTP Server 2.4.9

File Size :- 4.8 MB

Space Required :-  100 MB Approx.

By above link user can get the any installer file like .tar, .gz and binaries files for installation.


Apache HTTPD Server Dependencies & Requirements 

--  Required
  • Apr-1.5.1
  • Apr-Utill-1.5.3 
  • Pcre-8.35
-- Recommended 

·         OpenSSL-1.0.1h

Above packages are bundled and come with Apache installer file. Once user unzip or explodes the installer file downloaded, will get the all the packages and dependencies. 


APR and APR-utill 

Either you may install APR and APR-Utill on your system already or you may use both with Apache installation by downloading latest version from apache apr website. User needs to unpack the both folder into ./srclib/apr and ./srclib/apr-util ( here user has to make sure both directories names do not contain version numbers : Example :-  ./srclib/apr & ./srclib/apr-utill ). Some platforms may require -dev package to be installed for httpd server.

PCRE ( Perl -Compatible Regular Expression Library )

This library files are required for Apache HTTP server 2.4.9. it is not bundled with https, user may download it from http://www.pcre.org. First, User has to build pcre library for the system that will create pcre-config scripts installed by the PCRE build. To configuring Apache , user needs to add  --with-pcre parameter.

Configure PCRE

$ cd pcre-8.35

$ ./configure --prefix=PREFIX

PREFIX :- Here prefix represents home directory of pcre library. 

$ make

$ make install

above command will generate the pcre-config scripts under the pcre home directory. this pcre-config will be used during Apache installation.


Apache Installation Steps

Extraction

  $ gzip -d httpd-xx.tar.gz
 $ tar xvf httpd-xx.tar
  $ cd httpd-NN

Enter into the 03-httpd directory.

Configure Apache

Copy the APR, APR-Utill and pcre directory into the ./srclib of Apache installation.

$ ./configure --prefix=PREFIX --with-included-apr --with-included-pcre=<PATH TO PCRE-CONFIG generated at above step>


PREFIX = it is home directory of installation or by default location system will take /usr/local/apache2


Note :- Here user can add multiple modes for Apache Web server according to requirement.

Compile & install Apache

$ make 

Above command will compile the Apache package and file system.

$ make install

Upon successfully completion of above command. you can access your Apache HTTP server at port 80. To test it just hit the URL :- http://<hostname>:80
But you need to start the https service to access this. Please follow the below steps.


Customization

$ vi PREFIX/conf/httpd.conf

here user can change the server parameters like hostname, port and modules for the Apache.



$ cd PREFIX/bin

$ ./apachectl -k start  ( To start httpd server)

$ ./apachectl -k stop   ( To stop httpd server)

Other methods

$ /etc/init.d/httpd -start

$ /etc/init.d/httpd -stop

sometimes if service is registered with name "apache" then

$ /etc/intit.d/apache -start
$ /etc/init.d/apache -stop

using service

$ httpd stop
$ service httpd start




Verify httpd process on linux

$ ps -aef | grep httpd


Above command will show the running process information.








_____________________________________________________________________________

Oracle Weblogic Server Tuning Tasks



JAVA Code Tuning

  • JSP Pre-Compilation
  • EJB pool size cache
  • Deployment Descriptor (web.xml)
OS Tuning Parameter
  • Setting TCP-IP parameters
  • tcp_time_wait_interval
  • tcp_conn_req_max_q
Core Server Tuning
  • Weblogic server work manager
  • Chunk pool size
  • Connection backlog buffering
  • Use performance packs
JVM Tuning
  • Decide good GC strategy
  • Monitor garbage collection
  • define separate log files for GC log
  • Optimize heap size as per load 
By default, serialGC works with 1 CPU or host machine as   --XX:+UseSerialGC
Use parallel collector for multiprocessor or machines where your workload is basically CPU bound. 

Sunday, June 29, 2014

Installation of Mongo DB | No-Sql mongo db installation steps on Linux | mongo db comands

Installation of Mongo DB for 64 bit Linux

 

What is Mongo DB ? 
---  MongoDB is a cross-platform document-oriented database that is defined as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster. Released under a combination of the GNU Affero General Public License and the Apache License, MongoDB is free and open-source software.
-----------------------------Steps for Mongo DB installation on Linux -----------------------------------------
Step 1 :-  Select the directory under which you want to install mongo db and check all the permission is assigned to your user for this directory or not. example :- read, write and execute.
Step 2 :-  Copy the installer file (mongodb-linux-x86_64-2.6.1.tar.gz ) for Linux into the directory created into step 1.
Step 3. Extract the files from the installer through tar command.
$ tar -zxvf mongodb-linux-x86_64-2.6.1.tar.gz
Step 4 :-  ensure the location of the binaries is set in the PATH variable.
export PATH=<mongodb-install-directory>:$PATH
Here replace <mongodb-install-directory> with the path of mongo-Db binaries.
Step 5 :-  Create some folder or directories under the mongo db home..
-  bin
-  data
-  log
Before starting installation, User needs to create some config file and folders for mongo db installation as below
-- for mongo db process , create /data/db directory. If we create any other directory than we need to specify DBPATH variable in mongo.cfg   (config file) to start mongo db process on the Linux box.
Example :-  
DBPATH= /opt/app/mongodb/mongodb-linux-x86_64-2.4.1/data/db
---- for logs
MONGOD.log=/opt/app/mongodb/mongodb-linux-x86_64-2.4.1/log
Step 6 :-   Also we have to create a mongod.config file under mongo db home directory that will have all the details and paths required to run mongod process on Linux. For example see below path
mongod.config=/opt/app/mongodb/mongodb-linux-x86_64-2.4.1/
Step 7 :-   To start mongo db, execute below command from the bin directory of mongo db
$ mongod --config /opt/app/mongodb/mongodb-linux-x86_64-2.4.1/mongod.config  --dbpath  /opt/app/mongodb/mongodb-linux-x86_64-2.4.1/data/db  &
Here "& " will run the mongo db process in background.

 

 Using Mongo DB:

       Since Mongo DB is a NoSQL DB, we can create our DB and use them from command prompt.
        Some Useful commands to work with Mongo DB:
       
        Using the Mongo Shell (mongo.exe), you can interact with Mongo DB from the command line.
         [INFORMATIONAL] Commands
         1) Get information on the host running  MongoDB
              db.adminCommand( { "hostInfo" : 1 } )
         2) Get Mongo DB version details:
             db.runCommand( { buildInfo: 1 } )
         3) Get Mongo DB status:
            db.runCommand( { serverStatus: 1, workingSet: 1 } )
         4) Get disk storage use by database:
            show dbs
         5) Select the ‘admin’ database, and query for a list of databases in the Mongo DB instance:
           use admin
           db.runCommand( { listDatabases: 1 } )

 
         6) Get stats about the ‘admin` database:

            db.stats()


         7) Get stats about the ‘blobs’ collection:
            db.blobs.stats()


         8) Counts the number of all documents in the collection “nodes”:
           db.runCommand( { count: 'nodes' } )


         9) Get information on users defined
           db.runCommand( { usersInfo: 1 } )



++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mongo DB Basic Commands
Apache Server installation steps
Mongo DB installation Steps
Apache Server 2.4.9
No-Sql DB Mongod
Apache HTTP Webserver