Disable Elasticsearch listening on ipv6

By default elastic search is listening on ipv6 and not ipv4 when installed .

We can make it listen on on ipv4 by adding this line
network.host: _non_loopback:ipv4_ to /etc/elasticsearch/elasticsearch.yml configuration file .

Or we can disable ipv6 at Operating system level by adding below lines to /etc/sysctl.conf file
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

We can restart the server or just sudo sysctl -p to activate the changes

Configuring Local RPM repository on RHEL and Cent OS

———————————————————–

Sometimes we may need to install a bunch of rpm files at once . If we configure local yum repository , we can install all rpm files at once with yum command.

If a vendor is frequently updating the packages in the remote repository and you just want to stick with old packages , then you can download all rpm packages from teh vendor remote base URL and add them to local repository and then run yum install package.

To create a rpm repository first install “createrepo” package by running yum install createrepo

make a directory where you want to copy all rpm files.

# mkdir /My_repository

# cp from_rpms_directory/* /My_repository

Now run command

#createrepo /My_repository

Add repository file in /etc/yum.repos.d/

#vi /etc/yum.repos.d/my_app.repo

then add the entries like

[my_app]
name=My application from local repository
baseurl=file:///My_repository/
enabled=1
gpgcheck=0

Now we can issue yum command to install my_app package

# yum install my_app

If you have a web server running ,you can upload rpm files to the web directory and just replace file:// with http:// .

this way you can share this repository with other servers when you needed .

example baseurl=http://mywebserver_ip/repo/ .

BUG: Soft lockup CPU – CentOS

 

 

BUG: soft lockup – CPU#0 stuck for 67s! [migration/0:5].

I got this error a couple of times on centos server just after restarting  it . It just  stuck at boot screen .

I dont know what is the exact cause for this but  it booted normally when I did  powercycle the server at first time .

I think  this error is something related to device driver or something like  device driver uses spinlocks improperly.

But  the second time when it happend , i logged in to the server by booting from the grub menu with  acpi=off   switch at the end of kernel arguments

s

We can also increase the  kernel.softlockup_thresh  . for this ,

#sysctl -w kernel.softlockup_thresh=120

or edit

etc/sysctl.conf  to make it active at next reboot.

 

 

 

 

 

 

 

 

 

 

 

 

 

A script to show linux directory,file size

here is a small script to show the  size  of directories and files under linux . This will do what du command does but displays in a nice format.You can use this like treesize free tool for linux (: .

 

Save this script with some name like  filesz  in /usr/bin  and make it executable  . Type the command   filesz  from any directory to check the file/directory sizes

 

# vi filesz

copy the script  and !wq to save changes

#cp filesz /usr/bin

#chmod +x /usr/bin/filesz

 

####script starts##################

#/bin/sh
du -k --max-depth=1 | sort -nr | awk '
     BEGIN {
        split("KB,MB,GB,TB", Units, ",");
     }
     {
        u = 1;
        while ($1 >= 1024) {
           $1 = $1 / 1024;
           u += 1
        }
        $1 = sprintf("%.1f %s", $1, Units[u]);
        print $0;
     }
    '

##########script ends################################

Auto start freeswitch in cent OS

After compiling and  installing freeswitch on centOS from freeswitch source files , we can just copy  /usr/src/freeswitch/build/freeswitch.init.redhat   file to /etc/init.d directory and   correct the freeswitch path entries  to make it start at boot time .

copy the file to init.d directory and  add permissions

#cp /usr/src/freeswitch/build/freeswitch.init.redhat /etc/init.d/freeswitch

#chmod 755 /etc/init.d/freeswitch

edit the file  and correct the freeswitch path entries . On my  freeswicth  test server the entries are like below

 

PROG_NAME=freeswitch
PID_FILE=${PID_FILE-/usr/local/freeswitch/log/freeswitch.pid}
FS_USER=${FS_USER-freeswitch}
FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/freeswitch}
FS_HOME=${FS_HOME-/usr/local/freeswitch}
LOCK_FILE=/var/lock/subsys/freeswitch
FREESWITCH_ARGS=”-nc”

 

save the file  and  add it to auto start services list

 

chkconfig –level 345 freeswitch on

 

now chkconfig –list freeswitch should show something like below

<25>:chkconfig –list freeswitch
freeswitch 0:off 1:off 2:off 3:on 4:on 5:on 6:off

 

If we restart the system it should start free-switch automatically .

netstat -ptuln  command output will show if  free-switch is listening to the ports

 

 

Capture