Monday, July 31, 2017

Cannot Close 137 udp port - ubuntu

if you face some complains about port 137 udp netbios-service is open on your server and firewall cannot close these ports then check if you have samba or cifs installed on your system, then remove this service completely unless you need it for an important application.
Uninstall cifs-utils from Ubuntu 16.04
To remove cifs-utils package :
 
sudo apt-get remove cifs-utils

Uninstall cifs-utils and it's dependent packages
 
sudo apt-get remove --auto-remove cifs-utils

delete configuration and data files of cifs-utils :
 
sudo apt-get purge cifs-utils

delete configuration and data files of cifs-utils and it's dependencies :
 
sudo apt-get purge --auto-remove cifs-utils

Sunday, July 30, 2017

Raid1 Cannot Remove Drive From Raid Array


First, check the mdadm status
cat /proc/mdstatus

then, run
lsblsk
to see the available drives ,and after choosing the drives to be part of RAID,let's say sda,sdb
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb
if one hard disk fail and you want to replace it, then you need to flag it as fail part of raid the remove it from the raid array:
    mdadm --manage /dev/md1 --fail /dev/sdb2

then you can remove it from the raid array
    mdadm --manage /dev/md1 --remove /dev/sdb2
if you want to remove Raid1 : Check the Raid status -- these may will give you clear picture :
sudo mdadm --detail /dev/md0
and 
lsblk

Then stop and remove the Raid
mdadm --stop /dev/md0
mdadm --remove /dev/md0

tell the drive sda to forget about raid
sudo mdadm --zero-superblock /dev/sda/

if the system complain for being busy or such then
sudo dd if=/dev/zero of=/dev/sda
finally unmount the raid in the fstab file and comment it in the /etc/mdadm/mdadm.conf

Tuesday, July 18, 2017

10 most important seo rules

  • Select the right keywords really searchable by audience.
  • Select the domain name that reflect the keywords.
  • Use keywords in file names and folders if you have .
  •  Use keywords in your page titles "H1,H2,......" and the main title
  • Use keyword text in the internal links and their titles and alt attributes.
  • the Content is king , so don't  spaghettize  keywords , use with care
  • put keywords in the  Description meta tag
  • ssl is preferred for the links
  • Use keyword text in your out and in links
  •  Don't forget the site map

Monday, July 10, 2017

Warning: session_start(): Setting option 'session.hash_function' failed in on line

When I tried to add options parameters to session_start() php function, I got this warning
"Warning: session_start(): Setting option 'session.hash_function' failed in  on line "

I was using the full name of the parameter like this

session_hash_function
 
But the session_start function requires these parameters without the prefix "session", So the new parameter will be "hash_function"
session_start(["hash_function" =>  5 ]);

Notice: in PHP7.1: Session IDs will no longer be hashed upon generation. With this change brings about the removal of the following four ini settings:
    session.entropy_file
    session.entropy_length
    session.hash_function
    session.hash_bits_per_character

Wednesday, June 28, 2017

Fast Method to repair MySQL Master-Master Replication

Fast Method to repair Master-Master Replication

1. On th Good Server
a. mysqldump --add-drop-table --master-data  --quick -u root -p databaseName > databaseName.sql
b. bzip2 databaseName.sql
c.  scp databaseName.sql.bz2 -P port username@192.168.100.5:


2. On Bad Server
bunzip2 databaseName.sql.bz2

mysql> stop slave;
mysql -u root -p databaseName < databaseName.sql
mysql> start slave;
mysql> show slave status\G

You should see Slave_IO_Running: Yes and Slave_SQL_Running: Yes.

Now --
mysql> flush tables with read lock;
mysql> show master status;

Make a note of the File and Position rows.

mysql-bin.000044 | 11726351


3. On the Good Server
mysql> stop slave;
mysql> change master to master_log_file='mysql-bin.000044',
master_log_pos=11726351;
mysql> start slave;
mysql> show slave status\G

You should see Slave_IO_Running: Yes and Slave_SQL_Running: Yes.

4. on the Bad Server
mysql> unlock tables;

Monday, June 12, 2017

Setup Proxmox Cluster High Availability

from the main node issue the command

pvecm create clusterone 


from the other node :

pvecm add MAIN_NODE_IP 


we got cluster running now .

High Availability :

click on the 'Datacenter' --> HA --> Add : choose the virtual machine you need to add to HA.

to test HA is running  or not , go to the node where the virtual machine is install and down the network interface :

ifdown eth0 


the virtual machine should be still running while the main node is off.

Setting up Gluster
Reference 1
Reference 2
Refernce 3
Notice : Directory Need to be Manipulated to serve this job check Reference 2
 Add the GPG key to apt:

    wget -O - http://download.gluster.org/pub/gluster/glusterfs/3.11/rsa.pub | apt-key add -

Add the source:

    echo deb http://download.gluster.org/pub/gluster/glusterfs/3.11/LATEST/Debian/jessie/apt jessie main > /etc/apt/sources.list.d/gluster.list

or:
    echo deb http://download.gluster.org/pub/gluster/glusterfs/3.11/LATEST/Debian/stretch/apt stretch main > /etc/apt/sources.list.d/gluster.list

Update package list:

    apt-get update

Install:

    apt-get install  glusterfs-server glusterfs-client


from the master node
  gluster peer probe node1.proxmox
 

create the share named testvol with two replicas (please note that the number of replicas is equal to the number of servers :
 gluster volume create testvol replica 2 transport tcp master.proxmox:/data/testvol node1.proxmox:/data/testvol force

Gluster may complainn of spli brain issue , but I think proxmox can avoid that using fencing or Watchdog. Start the Volume
gluster volume start testvol

you can check the connection is established or not using :
 netstat -tap | grep glusterfsd 
if not check the required ports are open .
Now , from Proxmox Datacenter node , Choose --> Storage --> Add --> GlusterFS enter the name you like for this gluster storage, the ip of the two servers and the volume name "testvol" in our case

Don't forget to enables watchdog

just uncomment the line

# select watchdog module (default is softdog)
WATCHDOG_MODULE=ipmi_watchdog

Now It is time to do security job to secure the system

Commands:
Start Stop the Gluster service

 service glusterfs-server start | stop | status 

Information about gluster Volume
gluster volume info

Check status of high availability
systemctl status pve-ha-crm.service 

Check the Cluster Status
 pvecm status 

High Availability Command:
USAGE: ha-manager  [ARGS] [OPTIONS]
       ha-manager groupadd  -nodes  [OPTIONS]
       ha-manager groupconfig
       ha-manager groupremove 
       ha-manager groupset  [OPTIONS]

       ha-manager add  [OPTIONS]
       ha-manager config  [OPTIONS]
       ha-manager migrate  
       ha-manager relocate  
       ha-manager remove 
       ha-manager set  [OPTIONS]

       ha-manager status  [OPTIONS]

       ha-manager help [] [OPTIONS]

Proxmox Network Issues