jueves, 10 de enero de 2019

Orden Subida Cluster redhat 6


# service cman start
Starting cluster:
Checking if cluster has been disabled at boot… [ OK ]
Checking Network Manager… [ OK ]
Global setup… [ OK ]
Loading kernel modules… [ OK ]
Mounting configfs… [ OK ]
Starting cman… [ OK ]
Waiting for quorum… [ OK ]
Starting fenced… [ OK ]
Starting dlm_controld… [ OK ]
Starting gfs_controld… [ OK ]
Unfencing self… [ OK ]
Joining fence domain… [ OK ]

# service clvmd start
Starting clvmd:
Activating VG(s): Found duplicate PV v3CdfCX2DsI7NZSYVX0X0YnR6Rz4qyGH: using /dev/sdai1 not /dev/sdq1
Found duplicate PV LAZIG4x4eoZbh5ezYWcoNtBqM9DtS6Wf: using /dev/sdbo1 not /dev/sdaw1
1 logical volume(s) in volume group "VolGroup_tsm_PR2" now active
1 logical volume(s) in volume group "VolGroup_tsm_PR5" now active
1 logical volume(s) in volume group "VolGroup_tsm_PR1" now active
1 logical volume(s) in volume group "VolGroup_tsm_PR1" now active
1 logical volume(s) in volume group "VolGroup_arpr1" now active
1 logical volume(s) in volume group "VolGroup_z01" now active
1 logical volume(s) in volume group "VolGroup_x01" now active
1 logical volume(s) in volume group "VolGroup_tsm_PR2" now active
1 logical volume(s) in volume group "VolGroup_arpr5" now active
1 logical volume(s) in volume group "VolGroup_u01" now active
1 logical volume(s) in volume group "VolGroup_arpr2" now active
1 logical volume(s) in volume group "VolGroup_v00" now active
1 logical volume(s) in volume group "VolGroup_arpr1" now active
1 logical volume(s) in volume group "VolGroup_w00" now active
1 logical volume(s) in volume group "VolGroup_w01" now active
1 logical volume(s) in volume group "VolGroup_v01" now active
1 logical volume(s) in volume group "VolGroup_z00" now active
1 logical volume(s) in volume group "VolGroup_x00" now active
1 logical volume(s) in volume group "VolGroup_u00" now active
1 logical volume(s) in volume group "VolGroup_arposipr2" now active
3 logical volume(s) in volume group "VolGroup00" now active
[ OK ]

# service gfs2 start
GFS2: no entries found in /etc/fstab

# service rgmanager start
Starting Cluster Service Manager: [ OK ]

#

lunes, 7 de enero de 2019

Sacar /boot del multipath


# mkdir /boot.old
# umount /boot
# mount /dev/mapper/mpathap1 /boot.old/
# mount --bind /boot.old/ /boot    (menos menos bind)

# df -h (no se ve el bind aca pero si en el mount)

Filesystem           Size  Used  Avail  Use% Mounted on
/dev/mapper/VolGroup00-lv_root   30G  5.8G   23G  21% /
tmpfs                 16G     0   16G   0% /dev/shm
/dev/mapper/VolGroup00-lv_home 7.9G  2.6G  5.0G  35% /home
/dev/mapper/mpathap1 388M   65M  304M  18% /boot.old

# mount
/dev/mapper/VolGroup00-lv_root  on / type ext4 (rw)
proc on  /proc type proc (rw)
sysfs on  /sys type sysfs (rw)
devpts on  /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on  /dev/shm type tmpfs (rw)
/dev/mapper/mpathap1  on /boot.old type ext4 (rw)
/boot.old  on /boot type none (rw,bind)

Agregar lun a rhel cluster 5


Verificamos las wwn online y pedimos la lun.

#   cat /sys/class/fc_host/*/port_name
0x21000024ff219f38
0x21000024ff219f39
0x21000024ff2194ac
0x21000024ff2194ad
#   cat /sys/class/fc_host/*/port_state
Online
Online
Linkdown
Linkdown

Una vez que nos asignaron las luns rescaneamos, identificamos la lun y la editamos el /etc/multipath.conf para modificarle el nombre. (TODO ESTO EN LOS DOS NODOS)

# rescan-scsi-bus.sh
# multipath -F; multipath -v2
create: mpath27 (360050768018285d270000000000005b5)  IBM,2145
[size=200G][features=0][hwhandler=0][n/a]
\_ round-robin 0 [prio=50][undef]
 \_ 1:0:1:26 sdcm 69:160 [undef][ready]
 \_ 2:0:1:26 sdco 69:192 [undef][ready]
\_ round-robin 0 [prio=10][undef]
 \_ 1:0:0:26 sdcl 69:144 [undef][ready]
 \_ 2:0:0:26 sdcn 69:176 [undef][ready]
 
# vi /etc/multipath.conf
 ### Agregamos algo como esto
         multipath {
               wwid                    360050768018285d270000000000005b5
               alias                   mp_storage_u11
        }
        
# multipath -F; multipath -v2       

Con el disco reconocido por el sistema operativo procedemos a formatearlo, agregarlo a lvm.
# fdisk /dev/mapper/mp_storage_u11
[ ponemos todas las opciones que van  n - p - 1 - enter - enter 
  t 8e w ]
  
# pvcreate /dev/mapper/mp_storage_u11p1
# vgcreate vgstorage_u11 /dev/mapper/mp_storage_u11p1
# lvcreate -n lv_u11 -l 100%FREE vgstorage_u11 
Aca faltaria crear el fs y agregarlo al cluster el tema es que el tipo de fs es gfs2 asi que hay que darle un vueltita de rosca mas.

Con gfs2.tool buscamos la etiquieta de locktable que tienen los fs montados y la cantidad de journals (deberia ser un journal por nodo que lo monta)

# gfs2_tool list
253:52 gatclu:u10
253:58 gatclu:utsm
253:57 gatclu:uarchive
253:60 gatclu:gfs2
253:53 gatclu:u08
253:51 gatclu:u07
253:50 gatclu:u06
253:48 gatclu:gfs2-u05
253:61 gatclu:u04
253:59 gatclu:u03
253:56 gatclu:u02
253:55 gatclu:u01
253:54 gatclu:u00

# gfs2_tool journals /u09
journal1 - 128MB
journal0 - 128MB
2 journal(s) found.

Creamos entonces los fs y los agregamos al cluster.

mkfs.gfs2  -p lock_dlm -t gatclu:u11 -j2 /dev/vgstorage_u11/lv_u11
mount -t gfs2 /dev/vgstorage_u11/lv_u11 /u11

vi /etc/cluster/cluster.conf 
### Cambiar la config_version en la seccion cluster
<cluster config_version="48" name="gatclu">
### Agrego en la seccion resources TENER en cuenta el fsid que no se repita
<clusterfs device="/dev/vgstorage_u11/lv_u11" force_unmount="1" fsid="58377" 
fstype="gfs2" mountpoint="/u11" name="gfs2-u11" options="noatime,defaults"/>
### Agrego en la seccion service
<clusterfs ref="gfs2-u11">
</clusterfs>
Una vez revisado todo updateo la configuracion del cluster:

ccs_tool update /etc/cluster/cluster.conf

viernes, 4 de enero de 2019

Instalando wordpress en rhel con docker


Partimos de dos servidores con rhel 7, con docker instalado.
El servidor stlinux tiene salida a internet a traves de proxy y el dlstlinux1 no sale a ningun lado pero se publica el blog ahi y todos pueden acceder.

Los pasos a seguir eran bajar las imagenes de docker al plstlinux, exportarlas, copiarlas al dlstlinux1 y finalmente importarlas. Este fue el procedimiento:

Agregar el proxy al servicio docker en plstlinux.

vi /etc/systemd/system/docker.service.d/https-proxy.conf
 [Service]
 Environment="HTTPS_PROXY=https://DOMINIO\usuario:Mipassword2019@proxy:8080"

Reiniciar la confi de sysctl y el demonio de docker y chequear la configuracion recien editada.

systemctl daemon-reload
systemctl restart docker
systemctl show --property=Environment docker

Bajar las imagenes de docker y exportarlas a archivo.

docker pull mariadb:latest
docker pull wordpress:latest
docker save -o mariadb.docker mariadb
docker save -o wordpress.docker wordpress

Ahora las copio a dlstlinux1 las importo y sigo el procedimiento de instalacion que haya sacado de internet.

docker load -i mariadb.docker
docker load -i wordpress.docker 

docker run -e MYSQL_ROOT_PASSWORD=coneja -e MYSQL_DATABASE=wordpress --name wordpressdb \
-v "/docker/madb":/var/lib/mysql -d mariadb
docker run -e WORDPRESS_DB_PASSWORD=coneja --name wordpress --link wordpressdb:mysql \
 -p 8001:80 -v "/docker/wp":/var/www/html -d wordpress

Listo ya tengo instalado un mysql con un wordpress en el puerto 8001 del equipo.

Ahora borra la confi del proxy asi no te bloquea la pass y stopeo el docker del plstlinux que solo lo uso para bajar las imagenes.

rm -f /etc/systemd/system/docker.service.d/https-proxy.conf
systemctl daemon-reload
systemctl stop docker

jueves, 27 de diciembre de 2018

Cambiar/Agregar Semaforos

Para cambiar/ agregar semaforos en el sistema operativo, realizar :

Chequear los parametros actuales
~]# ipcs -sl

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32

semaphore max value = 32767

ipcs -s | wc -l

129

Con esto, cambio los valores 
echo kernel.sem = 250 64000 32 256 >>/etc/sysctl.conf

Con esto relee el archivo systctl.conf
sysctl -p 

Chequeo que haya tomado efecto los cambios
# ipcs -sl

------ Semaphore Limits --------
max number of arrays = 256
max semaphores per array = 250
max semaphores system wide = 64000
max ops per semop call = 32
semaphore max value = 32767

# sysctl kernel.sem
kernel.sem = 250        64000   32      256
[root@webmail-03 ~]#

# grep sem /etc/sysctl.conf
kernel.sem = 250 64000 32 256




Instalar Centrify

Para instalar Centrify por primera vez, Si esta instalado el Access Control previamente, primero desisntalar el AC

# /opt/CA/eTrustAccessControl/lbin/uninstall_AC
Trying to unload CA ControlMinder...
CA ControlMinder is successfully unloaded.

UnInstalling CA ControlMinder from /opt/CA/eTrustAccessControl

The uninstall utility is about to remove the entire
CA ControlMinder directory: /opt/CA/eTrustAccessControl
If you wish to keep certain files for future use or
reference, do NOT continue.

Continue with uninstall now? [Y/n]:   y
Removing CA ControlMinder service from /etc/services
Removing CA ControlMinder system call loader.
Trying to remove references to CA ControlMinder from the system init files.
Removing CA ControlMinder PAM module from your system.
Restoring /etc/pam.d/login by removing last changes made to file
Removing CA ControlMinder Admin tools binaries and directories.
Removing CA ControlMinder Admin tools X-resource files.
The CA ControlMinder Admin tools files have now
been removed from your system.
Removing seos.ini from /etc
The token global.AC_Version, now set to 'none', (was '12.81.0.19')
Removing ControlMinder from AccessControl Shared dependency list
Removing AccessControl Shared
Removing CAPKI.
Removing CA ControlMinder binaries and directories.

UnInstall complete.

The CA ControlMinder files have now been removed.

Warning: If you have replaced /bin/passwd with sepass,
         You must restore the original /bin/passwd.

         You may edit your /etc/passwd and /etc/group
         files, in order to remove unnecessary users.

#

Una vez desinstalado el AC,  borrar el archivo  /lib/security y crearlo como un directorio
mkdir /lib/security

Ahora si, instalo el Centrify

yum localinstall CentrifyDC-openssl-5.5.0-rhel5.x86_64.rpm  CentrifyDC-openldap-5.5.0-rhel5.x86_64.rpm CentrifyDC-curl-5.5.0-rhel5.x86_64.rpm \
CentrifyDC-5.5.0-rhel5.x86_64.rpm  CentrifyDC-nis-5.5.0-rhel5.x86_64.rpm CentrifyDA-3.5.0-rhel5.x86_64.rpm -y

Si necesito Desinstalar el Centrify, el orden es el siguiente:
rpm -e CentrifyDA-3.5.0-155.x86_64
rpm -e CentrifyDC-nis-5.5.0-200.x86_64
rpm -e CentrifyDC-5.5.0-200.x86_64
rpm -e CentrifyDC-curl-5.5.0-200.x86_64
rpm -e CentrifyDC-openldap-5.5.0-200.x86_64
rpm -e CentrifyDC-openssl-5.5.0-200.x86_64

miércoles, 6 de junio de 2018

Copiar luns en caliente con pvmove en lvm

Una maniobra tipica cuando queremos cambiar de caja de storage presentada en un equipo sin corte de servicio.

Una vez asignadas las luns nuevas al equipo las reconocemos y la metemos dentro de lvm.
Para reconocerlas utilizaremos rescan-scsi-bus.sh que viene en el pkg sg3_utils asi que vamos a comenzar instalandolo.

yum install sg3_utils

Rescaneamos discos y lo agregamos a multipath:

rescan-scsi-bus.sh
multipath -F;multipath -v2
multipath -ll

Agregamos los devices a la configuracion de multipath y volvemos a rescanear.
vi /etc/multipath.conf
multipaths {
        multipath {
                wwid                 XXXXXXXXXXXXXXXXX
                alias                   mp_01
        }
multipaths {
        multipath {
                wwid                 XXXXXXXXXXXXXXXXX
                alias                   mp_02
        }
Volvemos a refrescar la configuracion de multipath para que tome los cambios. 
multipath -F; multipath -v2

Creamos las particiones
fdisk /dev/mpath/mp_01 
( n - p - 1 - enter - enter - w )
fdisk /dev/mpath/mp_02 
( n - p - 1 - enter - enter - w )

partprobe /dev/mapper/mp_01
partprobe /dev/mapper/mp_02

Lo agregamos a lvm
pvcreate /dev/mapper/mp_01p1
pvcreate /dev/mapper/mp_02p1

Lo agregamos al vg
vgextend vgst /dev/mapper/mp_01p1
vgextend vgst_backup /dev/mapper/mp_02p1



Es muy importante si es un cluster freezar el servicio
clusvcadm -Z SERV1

Movemos la info de un pv a otro
pvmove /dev/dm-XX /dev/mapper/mp_01p1
pvmove /dev/dm-XY /dev/mapper/mp_02p1

Sacamos los pv viejos del vg
vgreduce vgst /dev/dm-XX
vgreduce vgst_backup /dev/dm-XY

Sacamos los discos de la configuracion.
pvremove /dev/dm-XX
pvremove /dev/dm-XY