<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL - Etienne ZINZINDOHOUE &#187; Linux</title>
	<atom:link href="https://blog.developpez.com/zinzineti/pcategory/linux/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/zinzineti</link>
	<description>Bases de données</description>
	<lastBuildDate>Thu, 09 Aug 2012 13:57:35 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>myLinuxBox</title>
		<link>https://blog.developpez.com/zinzineti/p9934/linux/mylinuxbox</link>
		<comments>https://blog.developpez.com/zinzineti/p9934/linux/mylinuxbox#comments</comments>
		<pubDate>Fri, 29 Apr 2011 15:48:08 +0000</pubDate>
		<dc:creator><![CDATA[zinzineti]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Redhat - CentOS]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Juste un petit entrepôt des mes utilitaires Linux &#8230; j&#8217;ai des petits utilitaires, des procédures de config, de paramétrage,&#8230;que je souhaite partager ici&#8230; je complèterai cet espace au fur et mesure que mon emploi du temps me le permet &#8230; Distribution Linux : Redhat ou CentOS => Redémarrer la machine reboot &#160; # ou bien &#160; shutdown –r => Arrêter de la machine shutdown –h => Afficher les interfaces réseaux ifconfig -a => Afficher les [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Juste un petit entrepôt des mes utilitaires Linux &#8230; j&rsquo;ai des petits utilitaires, des procédures de config, de paramétrage,&#8230;que je souhaite partager ici&#8230; je complèterai cet espace au fur et mesure que mon emploi du temps me le permet &#8230;<br />
<strong>Distribution Linux : Redhat ou  CentOS</strong><br />
<span id="more-122"></span><br />
<strong>=> Redémarrer la machine</strong></p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">reboot <br />
&nbsp;<br />
# ou bien <br />
&nbsp;<br />
shutdown –r</div></div>
</blockquote>
<p><strong>=> Arrêter de la machine</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">shutdown –h</span></code></p></blockquote>
<p><strong>=> Afficher les interfaces réseaux</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">ifconfig -a</span></code></p></blockquote>
<p><strong>=> Afficher les paramètres réseau d&rsquo;une interface (par exemple eth0)</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">ethtool eth0</span></code></p></blockquote>
<p><strong>=> Afficher le contenu du fichier hosts (fichier de résolution de nom des machines)</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">more /etc/hosts</span></code></p></blockquote>
<p><strong>=> Pour changer l&rsquo;adresse IP ou l&rsquo;adresse MAC de la machine</strong><br />
1. Modifier le fichier <strong>/etc/sysconfig/network-scripts/ifcfg-eth0</strong><br />
2. Redémarrer le service <strong>network</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">/etc/init.d/network restart</span></code></p></blockquote>
<p><strong>=> Pour changer le nom de la machine </strong><br />
1. Modifier le fichier <strong>/etc/sysconfig/network</strong><br />
2. Modifier également le fichier <strong>/etc/hosts</strong><br />
3. Redémarrer de la machine<br />
<blockquote><code class="codecolorer text default"><span class="text">reboot</span></code></p></blockquote>
<p>4. vérifier le nom de la machine<br />
<blockquote><code class="codecolorer text default"><span class="text">hostname</span></code></p></blockquote>
<p>=> <strong>Obtenir les espaces utilisés par les répertoires systèmes</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">&nbsp;df -h</span></code></p></blockquote>
<p>Et pour un système de fichier particulier comme tmp </p>
<blockquote><p><code class="codecolorer text default"><span class="text">&nbsp;df –h /tmp</span></code></p></blockquote>
<p>=> <strong>Obtenir Nom, Nom complet et DNS d’une machine</strong></p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hostname <br />
hostname -f <br />
hostname -d</div></div>
</blockquote>
<p>=> <strong>Monter un cdrom</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">mount /dev/cdrom /mnt</span></code></p></blockquote>
<p>=> <strong>Monter un disk (ou clé) USB</strong></p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># Vérifier si la clé (ou disque) USB est bien montée : <br />
lsusb <br />
# Obtenir l’adresse de la clé (ou disque) USB si elle n’est pas montée <br />
fdisk –l <br />
# Monter la clé USB (ou disque) <br />
mount /dev/sdxy &nbsp;/mnt <br />
&nbsp;<br />
# Dans mon cas le resultat de fdisk -l donne sdb1 donc sdxy = sdb1</div></div>
</blockquote>
<p>=> <strong>Configurer le redémarrage automatique du service  tomcat </strong><br />
<em>1. Copier/enregistrer le script ci-dessous dans le répertoire /etc/init.d<br />
   Sous le nom « tomcat » par exemple</em></p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># This is the init script for starting up the <br />
# &nbsp;Jakarta Tomcat server <br />
# <br />
# chkconfig: 345 91 10 <br />
# description: Starts and stops the Tomcat daemon. <br />
# <br />
&nbsp;<br />
# Source function library. <br />
. /etc/rc.d/init.d/functions <br />
&nbsp;<br />
# Get config. <br />
. /etc/sysconfig/network <br />
&nbsp;<br />
# Check that networking is up. <br />
&nbsp;[ &quot;${NETWORKING}&quot; = &quot;no&quot; ] &amp;&amp; exit 0 <br />
&nbsp;<br />
tomcat=/opt/apache-tomcat-5.5.27 <br />
startup=$tomcat/bin/startup.sh <br />
shutdown=$tomcat/bin/shutdown.sh <br />
export JAVA_HOME=/usr/java/jdk1.5.0_19 <br />
&nbsp;<br />
start(){ <br />
&nbsp;#echo -n $&quot;Starting Tomcat service: &quot; <br />
&nbsp;action $&quot;Stopping Tomcat service: &quot; $startup <br />
&nbsp;RETVAL=$? <br />
&nbsp;echo <br />
} <br />
&nbsp;<br />
stop(){ <br />
&nbsp;action $&quot;Stopping Tomcat service: &quot; $shutdown &nbsp;<br />
&nbsp;RETVAL=$? <br />
&nbsp;echo <br />
} <br />
&nbsp;<br />
restart(){ <br />
&nbsp; stop <br />
&nbsp; start <br />
} <br />
&nbsp;<br />
status(){ <br />
numproc=`ps -ef | grep catalina | grep -v &quot;grep catalina&quot; | wc -l` <br />
if [ $numproc -gt 0 ]; then <br />
echo &quot;Tomcat is running...&quot; <br />
else <br />
echo &quot;Tomcat is stopped...&quot; <br />
fi <br />
} <br />
&nbsp;<br />
# See how we were called. <br />
case &quot;$1&quot; in <br />
start) <br />
&nbsp;start <br />
&nbsp;;; <br />
stop) <br />
&nbsp;stop <br />
&nbsp;;; <br />
status) <br />
&nbsp; &nbsp; &nbsp; # This doesn't work ;) <br />
&nbsp;status tomcat <br />
&nbsp;;; <br />
restart) <br />
&nbsp;restart <br />
&nbsp;;; <br />
*) <br />
&nbsp;echo $&quot;Usage: $0 {start|stop|status|restart}&quot; <br />
&nbsp;exit 1 <br />
esac <br />
exit 0</div></div>
</blockquote>
<p><em>2. Modifier les droits de lecture et écriture du fichier précédent (tomcat)</em></p>
<blockquote><p><code class="codecolorer text default"><span class="text">chmod a+x tomcat</span></code></p></blockquote>
<p><em>3. Ajouter tomcat aux services </em></p>
<blockquote><p><code class="codecolorer text default"><span class="text">chkconfig –- add tomcat</span></code></p></blockquote>
<p><em>4. Configurer le run level pour que tomcat redemarre en mode auto </em></p>
<blockquote><p><code class="codecolorer text default"><span class="text">chkconfig --level 2345 tomcat on</span></code></p></blockquote>
<p>=> <strong>interface simple pour activer et désactiver les services </strong><br />
ntsysv fournit une interface simple pour activer et désactiver les services.</p>
<blockquote><p><code class="codecolorer text default"><span class="text">ntsysv</span></code> </p></blockquote>
<p>=> <strong>Configurer les interfaces réseaux eth0,eth1,&#8230; : Speed,Duplex et Auto-negotiation </strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">ethtool -s eth0 speed 100 duplex full autoneg off</span></code></p></blockquote>
<p>La commande ci-dessus configure automatiquement les paramètres Speed,Duplex et Auto-negation et engendre donc une coupure réseau. Il est donc conseillé d&rsquo;exécuter la commande en dehors des heures de service. Il faut noter aussi que cette configuration est perdue au redémarrage de la machine.<br />
Alors pour éviter de perdre la configuration au redémarrage du serveur, il faut en plus de la commande précédente modifier le fichier   <strong>/etc/sysconfig/network-scripts/ifcfg-eth*</strong></p>
<p><strong>Procédure</strong> </p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># se positionner dans le repertoire network-scripts <br />
&nbsp;<br />
&nbsp; cd /etc/sysconfig/network-scripts <br />
&nbsp;<br />
# lister les interfaces ethernet dispo sur la machine &nbsp;<br />
&nbsp;<br />
&nbsp;ll ifcfg-eth* <br />
&nbsp;<br />
# Ajouter à chaque fichier ifcfg-eth*( ifcfg-eth0, ifcfg-eth1,…) &nbsp;la ligne : ETHTOOL_OPTS=&quot;speed 100 duplex full autoneg off&quot; <br />
&nbsp; &nbsp; &nbsp; Exemple pour ifcfg-eth0 &nbsp;<br />
&nbsp;<br />
# vi ifcfg-eth0 <br />
&nbsp;<br />
# Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet <br />
DEVICE=eth0 <br />
BOOTPROTO=none <br />
BROADCAST=xxx.xx.xxx.xxx <br />
HWADDR=xx:xx:xx:xx:xx:xx <br />
IPADDR=xxx.xx.xxx.xx <br />
NETMASK=xxx.xxx.xxx.xxx <br />
NETWORK=xxx.xx.xxx.x <br />
ONBOOT=yes <br />
TYPE=Ethernet <br />
ETHTOOL_OPTS=&quot;speed 100 duplex full autoneg off&quot;</div></div>
</blockquote>
<p>=> <strong>Dévérouiller  un compte root </strong><br />
1. Se connecter à la machine avec un autre compte<br />
2. Modifier le fichier <strong>sshd_config</strong> en positionnant le paramètre PermitRootLogin sur la valeur  YES</p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">vi /etc/ssh/sshd_config <br />
&nbsp;<br />
# Et mettre le paramètre &nbsp;PermitRootLogin &nbsp;à YES <br />
&nbsp;<br />
PermitRootLogin = YES</div></div>
</blockquote>
<p>3. redémarrer le service sshd</p>
<blockquote><p><code class="codecolorer text default"><span class="text">service sshd restart</span></code></p></blockquote>
<p><strong>=> Recherche de fichier dans tous les répertoires</strong></p>
<p>Soit à rechercher tous les fichiers &laquo;&nbsp;ifcfg-eth*&nbsp;&raquo;  c&rsquo;est à dire &laquo;&nbsp;ifcfg-eth0&Prime;, &laquo;&nbsp;ifcfg-eth1&Prime;,&#8230;</p>
<blockquote><p><code class="codecolorer text default"><span class="text">find /* -name &quot;ifcfg-eth*&quot; -print</span></code></p></blockquote>
<p><strong>=> Configurer date-heure : commandes date ou hwclock </strong>  </p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># visualiser date heure <br />
&nbsp;<br />
&nbsp;date <br />
&nbsp;<br />
# visualiser date heure UTC/GMT <br />
&nbsp;<br />
&nbsp;date --utc <br />
&nbsp;<br />
# configurer l'heure (par exemple mettre l'heure actuelle à 13:42:05) <br />
&nbsp;<br />
&nbsp;date -s &quot;13:42:05&quot; <br />
&nbsp;<br />
# configurer la date seule sans toucher à l'heure <br />
&nbsp;<br />
&nbsp;date -s &quot;13:42:05 Apr 29, 2011&quot; <br />
&nbsp;<br />
# configurer le timezone <br />
&nbsp;<br />
&nbsp;dateconfig</div></div>
</blockquote>
<p><strong>=> Synchroniser une machine avec un serveur de temps (NTP) </strong></p>
<p><em>1. Modifier le fichier <strong>/etc/ntp.conf </strong></em><br />
Dans cet exemple le serveur NTP à pour IP : 172.xx.x.xxx</p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># Permit time synchronization with our time source, but do not <br />
# permit the source to query or modify the service on this system. <br />
restrict default kod nomodify notrap nopeer noquery <br />
&nbsp;<br />
# Permit all access over the loopback interface. &nbsp;This could <br />
# be tightened as well, but to do so would effect some of <br />
# the administrative functions. <br />
restrict 127.0.0.1 <br />
restrict -6 ::1 <br />
&nbsp;<br />
# Hosts on local network are less restricted. <br />
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap <br />
&nbsp;<br />
# Use public servers from the pool.ntp.org project. <br />
# Please consider joining the pool (http://www.pool.ntp.org/join.html). <br />
&nbsp;<br />
#broadcast 192.168.1.255 key 42 &nbsp; &nbsp; &nbsp; &nbsp; # broadcast server <br />
#broadcastclient &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# broadcast client <br />
#broadcast 224.0.1.1 key 42 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # multicast server <br />
#multicastclient 224.0.1.1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# multicast client <br />
#manycastserver 239.255.254.254 &nbsp; &nbsp; &nbsp; &nbsp; # manycast server <br />
#manycastclient 239.255.254.254 key 42 &nbsp;# manycast client <br />
&nbsp;<br />
# Undisciplined Local Clock. This is a fake driver intended for backup <br />
# and when no outside source of synchronized time is available. <br />
server 127.127.1.0 <br />
fudge &nbsp; 127.127.1.0 stratum 10 <br />
&nbsp;<br />
# Drift file. &nbsp;Put this in a directory which the daemon can write to. <br />
# No symbolic links allowed, either, since the daemon updates the file <br />
# by creating a temporary in the same directory and then rename()'ing <br />
# it to the file. <br />
driftfile /var/lib/ntp/drift <br />
&nbsp;<br />
# Key file containing the keys and key identifiers used when operating <br />
# with symmetric key cryptography. <br />
keys /etc/ntp/keys <br />
&nbsp;<br />
# Specify the key identifiers which are trusted. <br />
#trustedkey 4 8 42 <br />
&nbsp;<br />
# Specify the key identifier to use with the ntpdc utility. <br />
#requestkey 8 <br />
&nbsp;<br />
# Specify the key identifier to use with the ntpq utility. <br />
#controlkey 8 <br />
restrict default kod nomodify notrap nopeer noquery <br />
server 172.xx.x.xxx <br />
restrict 172.xx.x.xxx mask 255.255.255.255 nomodify notrap noquery</div></div>
</blockquote>
<p>2.Redémarrer le service ntpd</p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service ntpd start &nbsp;<br />
&nbsp;<br />
ou <br />
&nbsp;<br />
/etc/init.d/ntpd start</div></div>
</blockquote>
<p>3. Pour que le service ntpd redémarre automatiquement après un reboot de machine </p>
<blockquote><p><code class="codecolorer text default"><span class="text">chkconfig --level 345 ntpd on</span></code></p></blockquote>
<p>4.Vérifier que la synchronisation est effective</p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ntpstat;echo $?</div></div>
</blockquote>
<p>Exemple de résultat : le chiffre <strong>0</strong> à la fin indique que la machine est bien synchronisée<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<em><br />
synchronised to NTP server (172.xx.x.xxx) at stratum 4<br />
   time correct to within 172 ms<br />
   polling server every 1024 s </em><br />
<strong>0</strong></p>
<p>=> <strong>Planifié le Reboot automatique du serveur tous les dimanche à 22H30 </strong> </p>
<p><a href="http://fr.wikipedia.org/wiki/Crontab">Un lien intéressant sur le sujet </a><br />
<strong>0. Se connecter au serveur en tant que root</strong><br />
<strong>1. Vérifier si le service crond est installé et qu&rsquo;il est démarré</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">service crond status</span></code></p></blockquote>
<p> <strong>Démarrer le service crond si il n&rsquo;est pas dans l&rsquo;état &laquo;&nbsp;Running&nbsp;&raquo;</strong> :</p>
<blockquote><p><code class="codecolorer text default"><span class="text">service crond start</span></code></p></blockquote>
<p> <strong>Vérifier si le service crond demarre automatiquement au reboot </strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">chkconfig --list | grep crond</span></code></p></blockquote>
<p>résultat attendu les Level 345 doivent être à ON :</p>
<blockquote><p>crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off</p></blockquote>
<p>Si les Level 345 ne sont pas à ON il faut faire :</p>
<blockquote><p><code class="codecolorer text default"><span class="text">chkconfig --level 345 crond on</span></code></p></blockquote>
<p><strong>2. Créer le script de reboot, nous allons appelé ce script &laquo;&nbsp;reboot.sh&nbsp;&raquo; </strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">Vi /bin/reboot.sh</span></code></p></blockquote>
<p>Préparons le script reboot.sh qui écrit dans le fichier de log (trace)après le reboot:</p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/sh <br />
&nbsp; echo &quot;Reboot du serveur&quot; &gt;&gt; /tmp/log_reboot.log <br />
&nbsp; date &gt;&gt; /tmp/log_reboot.log</div></div>
</blockquote>
<p><strong>3. Modifier les droits sur le fichier reboot.sh</strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">chmod 777 reboot.sh</span></code></p></blockquote>
<p><strong>4. Pour scheduler le reboot exécuter</strong> :</p>
<blockquote><p><code class="codecolorer text default"><span class="text">crontab -e</span></code></p></blockquote>
<p><strong>5. Ajouter les lignes suivantes puis enregister</strong></p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">30 22 * * 0 reboot <br />
@reboot /bin/reboot.sh</div></div>
</blockquote>
<p><strong>6. Pour visualiser les tâches planifiées </strong></p>
<blockquote><p><code class="codecolorer text default"><span class="text">crontab -l</span></code></p></blockquote>
<p>=> <strong>Créer un user dans le groupe root </strong><br />
1. créer le compte<br />
<blockquote>useradd -m -g 0 admin</p></blockquote>
<p>2. initialiser le mot de passe du compte admin<br />
<blockquote>passwd admin</p></blockquote>
<p>=> <strong>Installer ou mettre à jour un RPM </strong></p>
<blockquote><p>rpm -Uhv * myfile.rmp</p></blockquote>
<p>=> <strong>Installer un RPM </strong></p>
<blockquote><p>rpm -ihv myfile.rmp</p></blockquote>
<p>=> <strong>Désinstaller un RPM </strong></p>
<blockquote><p>rpm -e myfile</p></blockquote>
<p>* Noter que la désinstallation du RPM il ne faut pas indiquer l&rsquo;extension(.rpm) du paquet RPM</p>
<p><strong>=> Configurer un serveur DNS sous CentOS 5</strong> <a href="http://www.aoddy.com/2007/11/18/how-to-install-dns-server-on-centos-5/">Procédure</a></p>
<p>=> <strong>Lister les caractéristiques d&rsquo;un serveur Linux </strong></p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">***************************************************************************************************** <br />
** LISTER LES COMPOSANTS D'UNE MACHINE SOUS LINUX &nbsp;<br />
***************************************************************************************************** <br />
&nbsp;<br />
***************************************************************************************************** <br />
** FILE SYSTEM <br />
***************************************************************************************************** <br />
# df -h <br />
&nbsp;<br />
***************************************************************************************************** <br />
** CPU <br />
***************************************************************************************************** <br />
# cat /proc/cpuinfo <br />
&nbsp; ou <br />
# dmesg | grep CPU &nbsp;<br />
&nbsp;<br />
***************************************************************************************************** <br />
** MEMOIRE <br />
***************************************************************************************************** <br />
# cat /proc/meminfo <br />
&nbsp;<br />
***************************************************************************************************** <br />
** DONNEES DU BIOS <br />
***************************************************************************************************** <br />
Récupérer les informations sur le matériel en collectant les informations depuis le BIOS. &nbsp;<br />
# dmidecode -t &lt;TYPE&gt; <br />
&nbsp;<br />
&lt;TYPE&gt; est un nombre extrait de la liste suivante : <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;Type &nbsp; Information <br />
&nbsp; &nbsp; &nbsp; &nbsp;---------------------------------------- <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; BIOS <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; System <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 &nbsp; Base Board <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; Chassis <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4 &nbsp; Processor <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; Memory Controller <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; Memory Module <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7 &nbsp; Cache <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8 &nbsp; Port Connector <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9 &nbsp; System Slots <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10 &nbsp; On Board Devices <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;11 &nbsp; OEM Strings <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;12 &nbsp; System Configuration Options <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;13 &nbsp; BIOS Language <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;14 &nbsp; Group Associations <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;15 &nbsp; System Event Log <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;16 &nbsp; Physical Memory Array <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;17 &nbsp; Memory Device <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;18 &nbsp; 32-bit Memory Error <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;19 &nbsp; Memory Array Mapped Address <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;20 &nbsp; Memory Device Mapped Address <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;21 &nbsp; Built-in Pointing Device <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;22 &nbsp; Portable Battery <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;23 &nbsp; System Reset <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;24 &nbsp; Hardware Security <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;25 &nbsp; System Power Controls <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;26 &nbsp; Voltage Probe <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;27 &nbsp; Cooling Device <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;28 &nbsp; Temperature Probe <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;29 &nbsp; Electrical Current Probe <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;30 &nbsp; Out-of-band Remote Access <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;31 &nbsp; Boot Integrity Services <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;32 &nbsp; System Boot <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;33 &nbsp; 64-bit Memory Error <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;34 &nbsp; Management Device <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;35 &nbsp; Management Device Component <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;36 &nbsp; Management Device Threshold Data <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;37 &nbsp; Memory Channel <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;38 &nbsp; IPMI Device <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;39 &nbsp; Power Supply <br />
&nbsp;<br />
**************************************************** <br />
** TYPE DE SERVEUR &nbsp;<br />
**************************************************** <br />
# dmidecode -t 1 <br />
# dmidecode 2.7 <br />
&nbsp;<br />
SMBIOS 2.5 present. <br />
Handle 0x000A, DMI type 1, 27 bytes. <br />
System Information <br />
&nbsp; &nbsp; &nbsp; &nbsp; Manufacturer: IBM <br />
&nbsp; &nbsp; &nbsp; &nbsp; Product Name: System x3650 M2 -[7947AC1]- <br />
&nbsp; &nbsp; &nbsp; &nbsp; Version: 00 <br />
&nbsp; &nbsp; &nbsp; &nbsp; Serial Number: KQRKBKK <br />
&nbsp; &nbsp; &nbsp; &nbsp; UUID: 28286A77-C724-3509-8C1F-7790C6E0FC2C <br />
&nbsp; &nbsp; &nbsp; &nbsp; Wake-up Type: Power Switch <br />
&nbsp; &nbsp; &nbsp; &nbsp; SKU Number: XxXxXxX <br />
&nbsp; &nbsp; &nbsp; &nbsp; Family: System x <br />
&nbsp;<br />
&nbsp;<br />
**************************************************** <br />
** TYPE DE CARTE MERE <br />
**************************************************** <br />
# dmidecode -t 2 <br />
# dmidecode 2.7 <br />
&nbsp;<br />
SMBIOS 2.5 present. <br />
Handle 0x000B, DMI type 2, 16 bytes. <br />
Base Board Information <br />
&nbsp; &nbsp; &nbsp; &nbsp; Manufacturer: IBM <br />
&nbsp; &nbsp; &nbsp; &nbsp; Product Name: 49Y6498 <br />
&nbsp; &nbsp; &nbsp; &nbsp; Version: (none) <br />
&nbsp; &nbsp; &nbsp; &nbsp; Serial Number: 9A804T <br />
&nbsp; &nbsp; &nbsp; &nbsp; Asset Tag: (none) <br />
&nbsp; &nbsp; &nbsp; &nbsp; Features: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Board is a hosting board <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Board is replaceable <br />
&nbsp; &nbsp; &nbsp; &nbsp; Location In Chassis: Rear Bottom <br />
&nbsp; &nbsp; &nbsp; &nbsp; Chassis Handle: 0x000C <br />
&nbsp; &nbsp; &nbsp; &nbsp; Type: Motherboard <br />
&nbsp; &nbsp; &nbsp; &nbsp; Contained Object Handles: 0 <br />
&nbsp;<br />
&nbsp;<br />
**************************************************** <br />
** TYPE DE CHASSIS <br />
**************************************************** <br />
# dmidecode -t 3 <br />
# dmidecode 2.7 <br />
&nbsp;<br />
SMBIOS 2.5 present. <br />
Handle 0x000C, DMI type 3, 17 bytes. <br />
Chassis Information <br />
&nbsp; &nbsp; &nbsp; &nbsp; Manufacturer: IBM <br />
&nbsp; &nbsp; &nbsp; &nbsp; Type: Rack Mount Chassis <br />
&nbsp; &nbsp; &nbsp; &nbsp; Lock: Not Present <br />
&nbsp; &nbsp; &nbsp; &nbsp; Version: none <br />
&nbsp; &nbsp; &nbsp; &nbsp; Serial Number: none <br />
&nbsp; &nbsp; &nbsp; &nbsp; Asset Tag: none <br />
&nbsp; &nbsp; &nbsp; &nbsp; Boot-up State: Safe <br />
&nbsp; &nbsp; &nbsp; &nbsp; Power Supply State: Safe <br />
&nbsp; &nbsp; &nbsp; &nbsp; Thermal State: Other <br />
&nbsp; &nbsp; &nbsp; &nbsp; Security Status: Other <br />
&nbsp; &nbsp; &nbsp; &nbsp; OEM Information: 0x00000000</div></div>
</blockquote>
<p>&#8212;</p>
<p><em><strong>A suivre &#8230;.</strong></em></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Etienne ZINZINDOHOUE</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>UCARP :  Mise en place de FAILOVER</title>
		<link>https://blog.developpez.com/zinzineti/p9937/linux/redhat-centos/ucarp_mise_en_place_de_failover</link>
		<comments>https://blog.developpez.com/zinzineti/p9937/linux/redhat-centos/ucarp_mise_en_place_de_failover#comments</comments>
		<pubDate>Mon, 02 May 2011 18:52:56 +0000</pubDate>
		<dc:creator><![CDATA[zinzineti]]></dc:creator>
				<category><![CDATA[Redhat - CentOS]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[L’application UCARP permet de mettre en place un système de failover automatique entre des serveurs. Ce mécanisme de disponibilité des applications sur des serveurs, nécessite une adresse IP virtuelle. Pour cet exemple nous avions SRV1 et SRV2 comme serveurs à mettre en failover. SRV1 IP : 172.20.X.12 SRV2 IP : 172.20.X.13 IP VIRTUEL : 172.20.X.10 => Installer le package yum sur les serveurs Avant d’installer UCARP sur les serveurs, il faut avant d’abord installer le [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>L’application UCARP permet de mettre en place un système de failover automatique entre des serveurs. Ce mécanisme de disponibilité des applications sur des serveurs, nécessite une adresse IP virtuelle.<br />
Pour cet exemple nous avions SRV1 et SRV2 comme serveurs à mettre en failover.</p>
<p><img src="http://zinzineti.ftp-developpez.com/images/ucarp.JPG" alt="UCARP - FAILOVER" title="UCARP - FAILOVER" /></p>
<p>SRV1 IP : 172.20.X.12<br />
SRV2 IP : 172.20.X.13<br />
IP VIRTUEL : 172.20.X.10<br />
<span id="more-123"></span><br />
=> <strong>Installer le package yum sur les serveurs</strong></p>
<p>Avant d’installer UCARP sur les serveurs, il faut avant d’abord installer le package yum depuis le dépôt de logicielle (repository software).</p>
<p>¤	Se connecter au serveur en tant que root<br />
¤	Exécuter la commande suivante :  </p>
<blockquote><p><code class="codecolorer text default"><span class="text">rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm</span></code></p></blockquote>
<p>=> <strong>Installer UCARP sur les serveurs</strong></p>
<p>¤	Se connecter au serveur en tant que root<br />
¤	Exécuter la commande suivante :  </p>
<blockquote><p><code class="codecolorer text default"><span class="text">yum -y install ucarp</span></code></p></blockquote>
<p>=> <strong>Configurer UCARP sur les serveurs </strong></p>
<p>Après installation d’UCARP sur les serveurs il faut maintenant configurer le fichier <strong>/etc/ucarp/vip-001.conf</strong></p>
<p><strong>Sur SRV1 (/etc/ucarp/vip-001.conf)</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em># ID SRV1<br />
ID=001</p>
<p># Network Interface<br />
BIND_INTERFACE=&nbsp;&raquo;eth0&Prime;</p>
<p># IP du serveur SRV1<br />
SOURCE_ADDRESS=&nbsp;&raquo;172.20.X.12&Prime;</p>
<p># IP Virtuel<br />
VIP_ADDRESS=&nbsp;&raquo;172.20.X.10&Prime;</p>
<p># UCARP Password<br />
PASSWORD=&nbsp;&raquo;ucarp-pw&nbsp;&raquo;</p>
<p># Options, pour voir toutes les options executer : ucarp &#8211; &#8211; help<br />
OPTIONS=&nbsp;&raquo;&#8211;shutdown &#8211;preempt&nbsp;&raquo;</em></p>
<p><strong>Sur SRV2 (/etc/ucarp/vip-001.conf)</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><em># ID SRV2 : doit être identique à celui du SRV1<br />
ID=001</p>
<p># Network Interface<br />
BIND_INTERFACE=&nbsp;&raquo;eth0&Prime;</p>
<p># IP du serveur  SRV2<br />
SOURCE_ADDRESS=&nbsp;&raquo;172.20.X.13&Prime;</p>
<p># IP Virtuel<br />
VIP_ADDRESS=&nbsp;&raquo;172.20.X.10&Prime;</p>
<p># UCARP Password : doit être identique à celui du SRV1<br />
PASSWORD=&nbsp;&raquo;ucarp-pw&nbsp;&raquo;</p>
<p># Options, pour voir toutes les options executer : ucarp &#8211; &#8211; help<br />
OPTIONS=&nbsp;&raquo;&#8211;shutdown &#8211;preempt&nbsp;&raquo;</em></p>
<p>=> <strong>Démarrer le service UCARP sur les serveurs </strong><br />
Après la configuration des fichiers /etc/ucarp/vip-001.conf sur les serveurs il faut démarrer le service UCARP en exécutant sur chaque serveur la commande :</p>
<blockquote><p><code class="codecolorer text default"><span class="text">service ucarp start</span></code></p></blockquote>
<p>et vérifier l’état du service avec la commande : </p>
<blockquote><p><code class="codecolorer text default"><span class="text">service ucarp status</span></code></p></blockquote>
<p>=> <strong>Activer le service UCARP au reboot automatique </strong><br />
Sur chaque serveur exécuter les commandes :</p>
<blockquote>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chkconfig --add ucarp <br />
&nbsp;<br />
chkconfig - - level 2345 ucarp on</div></div>
</blockquote>
<p>=> <strong>Master/Backup status</strong><br />
On démarrage UCARP négocie le status master/backup entre les serveurs SRV1 et SRV2.<br />
Pour vérifier quel est le serveur maître (master) ou esclave (backup) il faut jeter un d’œil dans le fichier <strong>/etc/log/messages</strong></p>
<p>Les fichiers :<br />
<em><strong>/etc/log/messages.1<br />
/etc/log/messages.2<br />
/etc/log/messages.x (x étant un entier)</strong></em></p>
<p>Exemple de contenu du fichier /etc/log/messages<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<blockquote><p>Apr 10 04:02:01 xxxxxxxxxxxx syslogd 1.4.1: restart.<br />
Apr 12 11:55:48 xxxxxxxxxxxx kernel: bnx2: eth0 NIC Copper Link is Down<br />
Apr 12 11:55:49 xxxxxxxxxxxx ucarp[32761]: [WARNING] Switching to state: BACKUP<br />
Apr 12 11:55:49 xxxxxxxxxxxx ucarp[32761]: [WARNING] Spawning<br />
Apr 12 11:55:49 xxxxxxxxxxxx ucarp[6523]: [WARNING] Switching to state: BACKUP<br />
Apr 12 11:55:49 xxxxxxxxxxxx ucarp[6523]: [WARNING] Spawning </p></blockquote>
<p>=> <strong>Failover test </strong></p>
<p>Après avoir identifié le serveur MASTER et le serveur BACKUP, on peut tester si le système failover fonctionne bien. </p>
<p>¤	Pour cela depuis la machine d’administration pingé l’IP VIRTUEL</p>
<p>Ping 172.20.X.10</p>
<p>Si la machine d’administration est du Windows exécuter donc :</p>
<p>Ping  -t 172.20.X.10</p>
<p>¤	Puis arrêter (shutdown) le serveur  MASTER </p>
<p>Résultat : Il ne doit pas y avoir perte de packets.</p>
<p>¤	Redémarrer le serveur MASTER </p>
<p>Résultat :<br />
&#8212;&#8212;&#8212;-<br />
Après redémarrage du service UCARP sur cette machine, Cette dernière reprend son rôle de MASTER (voir fichier /etc/log/messages ou /etc/log/messages.X)</p>
<p>Il faut noter que UCARP gère le failover de la machine (niveau système). UCARP ne sait pas gérer le failover d&rsquo;un service particulier comme tomcat ou autre. Donc pour gérer le failover au niveau services ou application il faut faire recours à un service de gestion de haute disponibilité plus pointu comme <strong>HEARTBEAT</strong></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Etienne ZINZINDOHOUE </p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
