Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:debian:6:senior:l131 [2020/01/30 03:29] – modification externe 127.0.0.1 | elearning:workbooks:debian:6:senior:l131 [2020/02/21 07:43] (Version actuelle) – créée admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | ======APF101 | + | Dernière mise-à-jour : ~~LASTMOD~~ |
- | =====Présentation d' | + | ====== LRF151 - Administration du Serveur MongoDB sous RHEL 7====== |
- | Un serveur web est une machine doté d'un logiciel serveur qui attend des requêtes de la part de machines clientes afin de leur livrer de documents de types différents. | + | Dans cette formation vous allez apprendre : |
- | En 1994 le développement du serveur web le plus connue à l' | + | * Ce qui est le NOSQL, |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | * Quelle est la structure des données | ||
+ | | ||
+ | | ||
- | Au début de l' | + | =====Présentation===== |
- | Le projet **Apache** est un projet de développement d'un serveur web libre pour les plateformes Unix et Windows(tm). La première version // | + | ====Qu'est-ce le NOSQL ?==== |
- | La **Fondation Apache**, créée en 1999 par l' | + | La naissance des outils NOSQL (//Not Only SQL//) a ses origines dans les limitations |
- | Apache est modulaire. Certains modules fondamentaux conditionnent comment Apache traite la question du multitraitement. Les modules multitraitements - **MPM - Multi-Processing Modules** - sont différents selon le système d' | + | De ce fait, chaque société a adopté ou a dévélopé sa propre solution de gestion de données : |
- | * **[[https:// | + | * Google - **[[https:// |
- | * **[[https:// | + | * Facebook - **[[https:// |
- | * **[[https:// | + | * Ubuntu One - **[[https:// |
- | * **[[https:// | + | * Baidu - **[[https:// |
- | * **[[https:// | + | * Amazon - **[[https:// |
- | * **[[https:// | + | * LinkedIn - **[[https:// |
+ | * SourceForge.net - **[[https://fr.wikipedia.org/wiki/MongoDB|MongoDB]]**. | ||
- | **Ces modules sont compilés statiquement au binaire Apache et sont mutuellement exclusifs.** | + | C'est à travers de ce dernier que ce cours propose de vous faire découvrir la mouvance NOSQL. |
- | =====Contenu | + | ====Présentation |
- | Dans ce cours, vous allez apprendre par la pratique | + | Dans le cas de MongoDB, les données prennent |
- | * LAB #1 - Gestion | + | ===Fonctionnalités |
- | * LAB #2 - Gestion des pages personnelles avec mod_userdir | + | |
- | =====Préparation===== | + | * La réplication permet de dupliquer les serveurs de base de données pour répondre à une montée en charge ou une tolérance de panne, |
+ | * Le Sharding (distribution de données sur plusieurs machines pour assurer la scalabilité) permet de répartir les données sur plusieurs serveurs soit pour simplement augmenter les performances soit pour répartir les données géographiquement, | ||
+ | * Système de fichiers **GridFS** qui permet de stocker simplement des fichiers en base de données, | ||
+ | * Le **SIG** ou **[[https:// | ||
+ | * La fonction de recherche : MongoDB intègre un système de recherche optimisé en fonction de la langue utilisée, | ||
+ | * MongoDB offre des nombreuses fonctionnalités que l’on trouve dans le monde relationnel (count, groupBy, etc.) mais aussi le support de la recherche full-text, la recherche géo-spatiale ou **[[https:// | ||
+ | * Supporte l’indexation pour l’optimisation des recherches. | ||
- | Désactivez le mode **enforcing** de SELINUX afin de pouvoir librement travailler avec Apache : | + | ===Historique du Projet=== |
- | < | + | MongoDB (de //Humongous// qui veut dire énorme ou immense) : |
- | [root@centos7 ~]# setenforce permissive | + | |
- | [root@centos7 ~]# getenforce | + | |
- | Permissive | + | |
- | [root@centos7 ~]# vi /etc/sysconfig/selinux | + | |
- | [root@centos7 ~]# cat /etc/ | + | |
- | # This file controls the state of SELinux on the system. | + | * est développé depuis 2007 par MongoDB, |
- | # SELINUX= can take one of these three values: | + | * a été industriellement viable en 2010 avec la version 1.4, |
- | # | + | * est écrit en langage C++. |
- | # | + | |
- | # | + | |
- | SELINUX=permissive | + | |
- | # SELINUXTYPE= can take one of three two values: | + | |
- | # | + | |
- | # | + | |
- | # mls - Multi Level Security protection. | + | |
- | SELINUXTYPE=targeted | + | |
- | </ | + | |
- | Afin d' | + | ===Versions Majeures=== |
- | < | + | ^ Version de MongoDB ^ Améliorations par rapport à la version précédente ^ |
- | [root@centos7 ~]# systemctl stop firewalld | + | | MongoDB 1.2.x | Création d' |
- | [root@centos7 ~]# systemctl disable firewalld | + | | MongoDB 1.4 | Amélioration de la mémoire d' |
- | [root@centos7 ~]# systemctl status firewalld | + | | MongoDB 1.6 | L' |
- | ● firewalld.service - firewalld - dynamic firewall daemon | + | | MongoDB |
- | Loaded: loaded (/ | + | | MongoDB 2.0 | Journaling est activé par défaut dans la version 2.0 pour les versions 64 bits \\ La commande compact est maintenant disponible pour le compactage des index \\ Réduction de la taille de la pile par défaut \\ Améliorations des Indices de performance \\ Les applications peuvent maintenant utiliser l' authentification avec les clusters fragmentées| |
- | Active: inactive | + | | MongoDB 2.2 | Opérations d' |
- | Docs: man: | + | | MongoDB 2.4 | Fonctionnalité Text Search \\ Ajout d'un nouvel indice de 2dsphere \\ Ajout d'un Index Hashed pour indexer des documents \\ Améliorations de la sécurité | |
+ | | MongoDB 2.6 | Agrégation Améliorées \\ Text Search activé par défaut \\ Nouveau protocole d' | ||
+ | | MongoDB 3.0 | MongoDB 3.0 introduit le WiredTiger comme moteur de stockage \\ Amélioration du moteur de stockage MMAPv \\ Augmentation du nombre de Replica Set Members \\ Amélioration des Clusters fragmentées \\ Améliorations des requêtes | | ||
+ | | MongoDB 3.2 | WiredTiger comme moteur par défaut de stockage \\ Amélioration des Clusters \\ Index partiels disponibles pour indexer des documents \\ Nouveaux opérateurs de requête \\ SpiderMonkey JavaScript Engine | | ||
- | Aug 21 16:23:02 centos7.i2tch.loc systemd[1]: Starting firewalld - dynamic firewall daemon... | + | ===Exécutables=== |
- | Aug 21 16:23:07 centos7.i2tch.loc systemd[1]: Started firewalld - dynamic firewall daemon. | + | |
- | Aug 21 16:29:49 centos7.i2tch.loc systemd[1]: Stopping firewalld - dynamic firewall daemon... | + | |
- | Aug 21 16:29:49 centos7.i2tch.loc systemd[1]: Stopped firewalld - dynamic firewall daemon. | + | |
- | </ | + | |
- | ===== Installation à partir | + | Le tableau suivant indique les noms des exécutables selon la base de donnée utilisée : |
- | Sous **RHEL / CentOS 7**, Apache n'est pas installé par défaut. Utilisez donc yum pour l' | + | ^ ^ MongoDB |
+ | | Serveur | ||
+ | | Client | ||
- | < | + | ===Avantages et Inconvénients=== |
- | [root@centos7 ~]# rpm -qa | grep httpd | + | |
- | [root@centos7 ~]# | + | |
- | [root@centos7 ~]# yum install httpd | + | |
- | </ | + | |
- | La version d' | + | ==Avantages== |
- | < | + | MongoDB : |
- | [root@centos7 ~]# rpm -qa | grep httpd | + | |
- | httpd-2.4.6-45.el7.centos.4.x86_64 | + | |
- | httpd-tools-2.4.6-45.el7.centos.4.x86_64 | + | |
- | </ | + | |
- | Configurez | + | * ne nécessite pas de schéma prédéfini des données d'où sa grande flexibilité, |
+ | * est une base de données orientée documents qui s’adapte parfaitement à de nombreuses applications, | ||
+ | * supporte une évolutivité à la charge (// | ||
+ | * supporte des indexes secondaires, | ||
+ | * propose un langage complet de requêtes et une stricte cohérence et stabilité, | ||
+ | * propose du calcul en mémoire, d'où la lecture et écriture rapides, | ||
+ | * propose la réplication en mode maître/ | ||
+ | * propose le Sharding (répartition automatique de données sur plusieurs machines). | ||
- | < | + | ==Inconvénients== |
- | [root@centos7 ~]# systemctl status httpd | + | |
- | ● httpd.service - The Apache HTTP Server | + | |
- | | + | |
- | | + | |
- | Docs: man: | + | |
- | | + | |
- | [root@centos7 ~]# systemctl enable httpd | + | |
- | Created symlink from / | + | |
- | </ | + | |
- | Lancez votre service apache | + | MongoDB |
- | < | + | |
- | [root@centos7 ~]# systemctl start httpd | + | * ne peut pas gérer de transactions complexes, |
- | [root@centos7 ~]# systemctl status httpd | + | * impose que la charge du contrôle des données soit reportée du côté de l’application puisque il n'y a pas de schéma, |
- | ● httpd.service - The Apache HTTP Server | + | * propose un langage d’interrogation qui lui est propre |
- | | + | |
- | Active: active (running) since Tue 2017-08-22 11:19:18 CEST; 3s ago | + | |
- | Docs: man: | + | |
- | man: | + | |
- | Main PID: 1293 (httpd) | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | Aug 22 11:19:18 centos7.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | + | ====Installation de MongoDB==== |
- | Aug 22 11:19:18 centos7.i2tch.loc systemd[1]: Started The Apache HTTP Server. | + | |
- | </ | + | |
- | =====Configuration sous RHEL / CentOS 7 ===== | + | Créez le fichier **/etc/ |
- | ====/ | + | < |
- | + | [root@centos7 ~]# vi /etc/yum.repos.d/mongodb-org-3.2.repo | |
- | Sous Red Hat / CentOS 7 le fichier de configuration principal d' | + | [root@centos7 ~]# cat /etc/yum.repos.d/mongodb-org-3.2.repo |
- | + | [mongodb-org-3.2] | |
- | < | + | name=MongoDB Repository |
- | [root@centos7 ~]# ls -lR /etc/httpd | + | baseurl=https://repo.mongodb.org/yum/redhat/$releasever/ |
- | /etc/ | + | gpgcheck=1 |
- | total 4 | + | enabled=1 |
- | drwxr-xr-x. 2 root root 35 Aug 22 11:17 conf | + | gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc |
- | drwxr-xr-x. 2 root root 78 Aug 22 11:17 conf.d | + | |
- | drwxr-xr-x. 2 root root 4096 Aug 22 11:17 conf.modules.d | + | |
- | lrwxrwxrwx. 1 root root 19 Aug 22 11:17 logs -> ../../var/log/httpd | + | |
- | lrwxrwxrwx. 1 root root 29 Aug 22 11:17 modules | + | |
- | lrwxrwxrwx. | + | |
- | + | ||
- | / | + | |
- | total 28 | + | |
- | -rw-r--r--. | + | |
- | -rw-r--r--. 1 root root 13077 Apr 12 23:04 magic | + | |
- | + | ||
- | /etc/httpd/conf.d: | + | |
- | total 16 | + | |
- | -rw-r--r--. 1 root root 2926 Apr 12 23:03 autoindex.conf | + | |
- | -rw-r--r--. 1 root root 366 Apr 12 23:04 README | + | |
- | -rw-r--r--. 1 root root 1252 Apr 12 15:50 userdir.conf | + | |
- | -rw-r--r--. 1 root root 824 Apr 12 15:50 welcome.conf | + | |
- | + | ||
- | /etc/httpd/conf.modules.d: | + | |
- | total 28 | + | |
- | -rw-r--r--. 1 root root 3739 Apr 12 15:50 00-base.conf | + | |
- | -rw-r--r--. 1 root root 139 Apr 12 15:50 00-dav.conf | + | |
- | -rw-r--r--. 1 root root 41 Apr 12 15:50 00-lua.conf | + | |
- | -rw-r--r--. 1 root root 742 Apr 12 15:50 00-mpm.conf | + | |
- | -rw-r--r--. 1 root root 957 Apr 12 15:50 00-proxy.conf | + | |
- | -rw-r--r--. 1 root root 88 Apr 12 15:50 00-systemd.conf | + | |
- | -rw-r--r--. 1 root root 451 Apr 12 15:50 01-cgi.conf | + | |
</ | </ | ||
- | Les directives actives du fichier **/ | + | Installez mongo : |
< | < | ||
- | [root@centos7 ~]# egrep -v '^(#|$)' | + | [root@centos7 ~]# yum install mongodb-org |
- | [root@centos7 ~]# cat /tmp/httpd.conf | + | Loaded plugins: fastestmirror, |
- | ServerRoot "/etc/httpd" | + | adobe-linux-x86_64 |
- | Listen 80 | + | base | 3.6 kB 00: |
- | Include conf.modules.d/*.conf | + | extras |
- | User apache | + | mongodb-org-3.2 |
- | Group apache | + | updates |
- | ServerAdmin root@localhost | + | (1/6): adobe-linux-x86_64/primary_db |
- | < | + | (2/6): extras/7/x86_64/primary_db |
- | | + | (3/6): base/7/x86_64/group_gz |
- | Require all denied | + | (4/6): mongodb-org-3.2/7/primary_db |
- | </Directory> | + | (5/6): base/7/x86_64/primary_db |
- | DocumentRoot "/var/www/html" | + | (6/6): updates/ |
- | < | + | Determining fastest mirrors |
- | AllowOverride None | + | * base: ftp.ciril.fr |
- | Require all granted | + | * extras: ftp.ciril.fr |
- | </Directory> | + | * updates: centos.crazyfrogs.org |
- | < | + | Resolving Dependencies |
- | Options Indexes FollowSymLinks | + | --> Running transaction check |
- | AllowOverride None | + | ---> Package mongodb-org.x86_64 0: |
- | Require all granted | + | --> Processing Dependency: mongodb-org-tools = 3.2.16 for package: mongodb-org-3.2.16-1.el7.x86_64 |
- | </Directory> | + | --> Processing Dependency: mongodb-org-shell = 3.2.16 for package: mongodb-org-3.2.16-1.el7.x86_64 |
- | < | + | --> Processing Dependency: mongodb-org-server = 3.2.16 for package: mongodb-org-3.2.16-1.el7.x86_64 |
- | DirectoryIndex index.html | + | --> Processing Dependency: mongodb-org-mongos = 3.2.16 for package: mongodb-org-3.2.16-1.el7.x86_64 |
- | </IfModule> | + | --> Running transaction check |
- | <Files ".ht*"> | + | ---> Package mongodb-org-mongos.x86_64 0:3.2.16-1.el7 will be installed |
- | | + | ---> Package mongodb-org-server.x86_64 0:3.2.16-1.el7 will be installed |
- | </ | + | ---> Package mongodb-org-shell.x86_64 0: |
- | ErrorLog " | + | ---> Package mongodb-org-tools.x86_64 0:3.2.16-1.el7 will be installed |
- | LogLevel warn | + | --> Finished Dependency Resolution |
- | < | + | |
- | | + | |
- | LogFormat "%h %l %u %t \" | + | |
- | < | + | |
- | | + | |
- | </ | + | |
- | | + | |
- | </ | + | |
- | < | + | |
- | ScriptAlias /cgi-bin/ "/ | + | |
- | </ | + | |
- | < | + | |
- | AllowOverride None | + | |
- | Options None | + | |
- | Require all granted | + | |
- | </ | + | |
- | < | + | |
- | TypesConfig /etc/mime.types | + | |
- | AddType application/ | + | |
- | | + | |
- | AddType text/ | + | |
- | AddOutputFilter INCLUDES | + | |
- | </ | + | |
- | AddDefaultCharset UTF-8 | + | |
- | < | + | |
- | MIMEMagicFile conf/ | + | |
- | </ | + | |
- | EnableSendfile on | + | |
- | IncludeOptional conf.d/*.conf | + | |
- | </code> | + | |
- | ====Les Directives du fichier / | + | Dependencies Resolved |
- | ===ServerRoot=== | + | ================================================================================================================================================================================================ |
+ | | ||
+ | ================================================================================================================================================================================================ | ||
+ | Installing: | ||
+ | | ||
+ | Installing for dependencies: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | Cette directive indique la racine de la configuration d' | + | Transaction Summary |
+ | ================================================================================================================================================================================================ | ||
+ | Install | ||
- | < | + | Total download size: 66 M |
- | ServerRoot "/ | + | Installed size: 202 M |
- | </ | + | Is this ok [y/d/N]: y |
- | + | ||
- | ===Listen=== | + | |
- | + | ||
- | Cette directive indique le port écouté par apache. | + | |
- | + | ||
- | < | + | |
- | Listen 80 | + | |
- | </ | + | |
- | + | ||
- | ===Include=== | + | |
- | + | ||
- | Cette directive indique que les fichiers de configuration inclus dans le répertoire **conf.modules.d/ | + | |
- | + | ||
- | < | + | |
- | Include conf.modules.d/ | + | |
- | </ | + | |
- | + | ||
- | ===User et Group=== | + | |
- | + | ||
- | Cette directive indique l'UID et le GID de l' | + | |
- | + | ||
- | < | + | |
- | User apache | + | |
- | Group apache | + | |
- | </file> | + | |
- | + | ||
- | ===ServerAdmin=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | ServerAdmin root@localhost | + | |
- | </ | + | |
- | + | ||
- | ===< | + | |
- | + | ||
- | Cette directive permet de regrouper | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ===Require all=== | + | |
- | + | ||
- | Cette directive autorise ou interdit l' | + | |
- | + | ||
- | < | + | |
- | Require all denied | + | |
- | </ | + | |
- | + | ||
- | ===AllowOverride=== | + | |
- | + | ||
- | Cette directive stipule comment Apache doit utiliser les directives situées dans un éventuel fichier **.htaccess** La valeur **none** désactive l' | + | |
- | + | ||
- | < | + | |
- | AllowOverride None | + | |
- | </ | + | |
- | + | ||
- | ===</ | + | |
- | + | ||
- | Cette directive ferme le bloc **Directory**. | + | |
- | + | ||
- | < | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===DocumentRoot=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | DocumentRoot "/ | + | |
- | </ | + | |
- | + | ||
- | ===< | + | |
- | + | ||
- | Cette directive définit des règles pour le répertoire **/ | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ===AllowOverride=== | + | |
- | + | ||
- | Cette directive stipule comment Apache doit utiliser les directives situées dans un éventuel fichier **.htaccess** La valeur **none** désactive l' | + | |
- | + | ||
- | < | + | |
- | AllowOverride None | + | |
- | </ | + | |
- | + | ||
- | ===Require all=== | + | |
- | + | ||
- | Cette directive autorise ou interdit l' | + | |
- | + | ||
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | + | ||
- | ===</ | + | |
- | + | ||
- | Cette directive ferme le bloc **Directory**. | + | |
- | + | ||
- | < | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===< | + | |
- | + | ||
- | Cette directive définit des règles pour le répertoire **htdocs** : | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ===Indexes=== | + | |
- | + | ||
- | La directive Options active (+) ou désactive (-) des fonctions spécifiques. Dans ce cas **Indexes** autorise au serveur apache de générer une liste du contenu du répertoire dans le cas ou le fichier index ne peut pas être trouve tandis que **%%FollowSymLinks%%** permet à apache de suivre les liens symboliques. | + | |
- | + | ||
- | < | + | |
- | Options Indexes FollowSymLinks | + | |
- | </ | + | |
- | + | ||
- | ===AllowOverride=== | + | |
- | + | ||
- | Cette directive stipule comment Apache doit utiliser les directives situées dans un éventuel fichier **.htaccess** La valeur **none** désactive l' | + | |
- | + | ||
- | < | + | |
- | AllowOverride None | + | |
- | </ | + | |
- | + | ||
- | ===Require all=== | + | |
- | + | ||
- | Cette directive autorise ou interdit l' | + | |
- | + | ||
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | + | ||
- | ===</ | + | |
- | + | ||
- | Cette directive ferme le bloc **Directory**. | + | |
- | + | ||
- | < | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===IfModule=== | + | |
- | + | ||
- | **%%IfModule dir_module%%** indique que le pavé ne sera interprété QUE dans le cas ou le module dir_module soit chargé. | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ==DirectoryIndex== | + | |
- | + | ||
- | La directive **%%DirectoryIndex%%** stipule la liste des pages servies par défaut. | + | |
- | + | ||
- | < | + | |
- | DirectoryIndex index.html | + | |
- | </ | + | |
- | + | ||
- | ===</ | + | |
- | + | ||
- | Cette directive ferme le bloc **%%IfModule%%** | + | |
- | + | ||
- | < | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===Files=== | + | |
- | + | ||
- | La directive Files recherche des fichiers qui correspondent a l' | + | |
- | + | ||
- | < | + | |
- | <Files " | + | |
- | Require all denied | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===ErrorLog=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | ErrorLog " | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===LogLevel=== | + | |
- | + | ||
- | Cette directive indique le niveau de journalisation au format **syslog**: debug, info, notice, warn, error, crit, alert, emerg. | + | |
- | + | ||
- | < | + | |
- | LogLevel warn | + | |
- | </ | + | |
- | + | ||
- | ===IfModule=== | + | |
- | + | ||
- | **%%IfModule log_config_module%%** indique que le pavé ne sera interprété QUE dans le cas ou le module log_config_module soit chargé. | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ===LogFormat=== | + | |
- | + | ||
- | La directive **%%LogFormat%%** définit un format de journal et l' | + | |
- | + | ||
- | LogFormat format|nom | + | |
- | + | ||
- | < | + | |
- | LogFormat "%h %l %u %t \" | + | |
- | LogFormat "%h %l %u %t \" | + | |
- | LogFormat "%h %l %u %t \" | + | |
- | </ | + | |
- | + | ||
- | L' | + | |
- | + | ||
- | Les significations des chaînes de formatage sont les suivantes : | + | |
- | + | ||
- | ^ Chaîne ^ Description ^ | + | |
- | | %b | La taille de la réponse sans les entêtes HTTP. Le caractère **-** indique 0 | | + | |
- | | %h | L' | + | |
- | | %l | Le nom du compte de l' | + | |
- | | %r | La première ligne de la requête | | + | |
- | | %>s | Le statut de la dernière requête | | + | |
- | | %t | L' | + | |
- | | %u | Le nom du compte de l' | + | |
- | | %U | l'URL demandé | | + | |
- | | %{Referer}i | Le contenu de **Referer** dans l' | + | |
- | | %{User-agent}i | Le contenu de **User-agent** dans l' | + | |
- | | %I | Octets reçus, en-têtes et corps de requête inclus ; ne peut pas être nul. | | + | |
- | | %O | Octets envoyés, en-têtes inclus ; ne peut pas être nul. | | + | |
- | + | ||
- | ===CustomLog=== | + | |
- | + | ||
- | La directive **%%CustomLog%%** est utilisée pour écrire les journaux. Cette directive prend la forme : | + | |
- | + | ||
- | CustomLog fichier|tube format | + | |
- | + | ||
- | < | + | |
- | CustomLog " | + | |
- | </ | + | |
- | + | ||
- | Le premier argument est donc soit : | + | |
- | + | ||
- | * un **fichier** - un chemin complet, relatif à **%%ServerRoot%%**, | + | |
- | * un **tube** - le caractère **|** suivi par un chemin indiquant le programme qui recevra l' | + | |
- | + | ||
- | Le deuxième argument peut être soit : | + | |
- | + | ||
- | * Un **format** - un format de journal si celui-ci n'a pas été définit par une directive **%%LogFormat%%**, | + | |
- | * Un **nom** - un nom définit par une directive **%%LogFormat%%** | + | |
- | + | ||
- | Consultez votre journal d' | + | |
- | + | ||
- | < | + | |
- | [root@centos7 ~]# cat / | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
- | 127.0.0.1 - - [22/ | + | |
</ | </ | ||
- | où : | + | Activez et démarrez |
- | + | ||
- | ^ Chaîne ^ Valeur ^ | + | |
- | | %h | 127.0.0.1 | | + | |
- | | %l | - | | + | |
- | | %u | - | | + | |
- | | %t | [22/ | + | |
- | | %r | "GET / | + | |
- | | %>s | 404 | | + | |
- | | %b | 209 | | + | |
- | | %{Referer}i | - | | + | |
- | | %{User-agent}i | " | + | |
- | + | ||
- | ===</ | + | |
- | + | ||
- | Cette directive ferme le bloc **%%IfModule%%** | + | |
- | + | ||
- | < | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===ScriptAlias=== | + | |
- | + | ||
- | La directive **ScriptAlias** sert ici à créer un lien pour le répertoire **cgi-bin** dans le cas où le module **alias_module** soit chargé : | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | ScriptAlias /cgi-bin/ "/ | + | |
- | </ | + | |
- | < | + | |
- | AllowOverride None | + | |
- | Options None | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===TypesConfig=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | TypesConfig / | + | |
- | ... | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===AddType=== | + | |
- | + | ||
- | Cette directive stipule un contenu MIME-type pour une extension de fichier donnée dans le cas où le module **mime_module** soit chargé : | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | ... | + | |
- | AddType application/ | + | |
- | AddType application/ | + | |
- | AddType text/html .shtml | + | |
- | ... | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===AddoutputFilter=== | + | |
- | + | ||
- | La directive **%%AddOutputFilter%%** fait correspondre une extension de fichier avec un **filtre**. Les réponses du serveur aux requêtes des clients sont ensuite envoyées vers le filtre avant d' | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | ... | + | |
- | AddOutputFilter INCLUDES .shtml | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===AddDefaultCharset=== | + | |
- | + | ||
- | Cette directive spécifie un jeu de caractères par défaut de UTF-8 pour tout document du type text/plain ou text/html. L' | + | |
- | + | ||
- | < | + | |
- | AddDefaultCharset UTF-8 | + | |
- | </ | + | |
- | + | ||
- | ===MIMEMagicFile=== | + | |
- | + | ||
- | Cette directive stipule le fichier magic. Le fichier magic est utilise pour déterminer le type mime d'un fichier. | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | MIMEMagicFile conf/ | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===EnableSendfile=== | + | |
- | + | ||
- | Cette directive définit si le programme httpd peut utiliser le support sendfile du noyau pour transmettre le contenu des fichiers aux clients. Par défaut, lorsque le traitement d'une requête ne requiert pas l' | + | |
- | + | ||
- | < | + | |
- | EnableSendfile on | + | |
- | </ | + | |
- | + | ||
- | ===IncludeOptional=== | + | |
- | + | ||
- | Cette directive permet d' | + | |
- | + | ||
- | < | + | |
- | IncludeOptional conf.d/ | + | |
- | </ | + | |
- | + | ||
- | =====/ | + | |
- | + | ||
- | Les directives actives du fichier **/ | + | |
< | < | ||
- | [root@centos7 ~]# egrep -v '^(# | + | [root@centos7 ~]# systemctl status mongod |
- | [root@centos7 ~]# cat /tmp/autoindex.conf | + | ● mongod.service |
- | IndexOptions FancyIndexing HTMLTable VersionSort | + | |
- | Alias /icons/ "/ | + | |
- | < | + | Docs: man: |
- | | + | [root@centos7 ~]# systemctl enable mongod |
- | | + | mongod.service is not a native service, redirecting to /sbin/chkconfig. |
- | Require all granted | + | Executing |
- | </ | + | [root@centos7 ~]# systemctl start mongod |
- | AddIconByEncoding (CMP,/ | + | [root@centos7 ~]# systemctl status mongod |
- | AddIconByType | + | ● mongod.service |
- | AddIconByType (IMG,/icons/ | + | Loaded: loaded |
- | AddIconByType | + | Active: active |
- | AddIconByType | + | Docs: man: |
- | AddIcon | + | |
- | AddIcon /icons/binhex.gif .hqx | + | CGroup: |
- | AddIcon | + | └─14255 |
- | AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv | + | |
- | AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip | + | |
- | AddIcon | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon /icons/f.gif .for | + | |
- | AddIcon | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | DefaultIcon / | + | |
- | ReadmeName README.html | + | |
- | HeaderName HEADER.html | + | |
- | IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t | + | |
- | </ | + | |
- | ====Les Directives du fichier / | + | Sep 18 13:46:08 centos7.fenestros.loc systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database.... |
- | + | Sep 18 13:46:08 centos7.fenestros.loc runuser[14251]: | |
- | ===IndexOptions=== | + | Sep 18 13:46:09 centos7.fenestros.loc mongod[14244]: Starting mongod: [ OK ] |
- | + | Sep 18 13:46:09 centos7.fenestros.loc systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database.. | |
- | **mod_autoindex** permet la génération automatique des listes du contenu d'un répertoire quand la page d' | + | |
- | + | ||
- | < | + | |
- | IndexOptions FancyIndexing HTMLTable VersionSort | + | |
- | </ | + | |
- | + | ||
- | ===Alias=== | + | |
- | + | ||
- | La directive **Alias** sert ici à créer un lien pour le répertoire **icons** | + | |
- | + | ||
- | < | + | |
- | Alias /icons/ "/ | + | |
- | </ | + | |
- | + | ||
- | ===< | + | |
- | + | ||
- | Cette section définit les règles pour le répertoire **/ | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | Options Indexes MultiViews FollowSymlinks | + | |
- | AllowOverride None | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===AddIconByEncoding=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | AddIconByEncoding (CMP,/ | + | |
- | </ | + | |
- | + | ||
- | ===AddIconByType=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | AddIconByType (TXT,/ | + | |
- | AddIconByType (IMG,/ | + | |
- | AddIconByType (SND,/ | + | |
- | AddIconByType (VID,/ | + | |
- | </ | + | |
- | + | ||
- | ===AddIcon=== | + | |
- | + | ||
- | Cette directive indique l' | + | |
- | + | ||
- | < | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | AddIcon / | + | |
- | </ | + | |
- | + | ||
- | ===DefaultIcon=== | + | |
- | + | ||
- | La directive **%%DefaultIcon%%** indique l' | + | |
- | + | ||
- | < | + | |
- | DefaultIcon / | + | |
- | </ | + | |
- | + | ||
- | ===ReadmeName=== | + | |
- | + | ||
- | Cette directive indique le fichier qui sera ajouter à la fin de l' | + | |
- | + | ||
- | < | + | |
- | ReadmeName README.html | + | |
- | </ | + | |
- | + | ||
- | ===HeaderName=== | + | |
- | + | ||
- | Cette directive indique le fichier qui sera inséré en tête de l' | + | |
- | + | ||
- | < | + | |
- | HeaderName HEADER.html | + | |
- | </ | + | |
- | + | ||
- | ===IndexIgnore=== | + | |
- | + | ||
- | Cette directive stipule les types de fichiers à exclure de l' | + | |
- | + | ||
- | < | + | |
- | IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t | + | |
- | </ | + | |
- | + | ||
- | =====/ | + | |
- | + | ||
- | Ce fichier configure la mise à disposition de pages personnelles pour chaque utilisateur ayant un compte sur le serveur Linux. | + | |
- | + | ||
- | Les directives actives du fichier **/ | + | |
- | + | ||
- | < | + | |
- | [root@centos7 | + | |
- | [root@centos7 ~]# cat / | + | |
- | < | + | |
- | UserDir disabled | + | |
- | </ | + | |
- | < | + | |
- | AllowOverride FileInfo AuthConfig Limit Indexes | + | |
- | Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec | + | |
- | Require method GET POST OPTIONS | + | |
- | </ | + | |
</ | </ | ||
- | ====Les Directives du fichier / | + | Le client MongoDB |
- | + | ||
- | ===< | + | |
- | + | ||
- | Cette directive vérifie si mod_userdir est active. | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ===UserDir=== | + | |
- | + | ||
- | Le but de cette directive | + | |
- | + | ||
- | < | + | |
- | UserDir disable | + | |
- | </ | + | |
- | + | ||
- | =====/ | + | |
- | + | ||
- | Ce fichier configure l' | + | |
- | + | ||
- | Les directives actives du fichier **/ | + | |
< | < | ||
- | [root@centos7 ~]# egrep -v ' | + | [root@centos7 ~]# mongo |
- | [root@centos7 ~]# cat / | + | MongoDB shell version: 3.2.16 |
- | < | + | connecting to: test |
- | Options -Indexes | + | Welcome to the MongoDB shell. |
- | ErrorDocument 403 /.noindex.html | + | For interactive help, type "help". |
- | </ | + | For more comprehensive documentation, |
- | < | + | http://docs.mongodb.org/ |
- | AllowOverride None | + | Questions? Try the support group |
- | Require all granted | + | http://groups.google.com/group/mongodb-user |
- | </ | + | Server has startup warnings: |
- | Alias /.noindex.html /usr/ | + | 2017-09-18T13:46:09.416+0200 I CONTROL |
- | Alias /noindex/css/bootstrap.min.css /usr/share/ | + | 2017-09-18T13: |
- | Alias / | + | > exit |
- | Alias / | + | bye |
- | Alias / | + | [root@centos7 ~]# |
</ | </ | ||
- | =====/ | + | ===Configuration=== |
- | Ces fichiers configurent le chargement des modules d' | + | Le fichier |
- | + | ||
- | Par exemple, les directives actives du fichier **/etc/httpd/ | + | |
< | < | ||
- | [root@centos7 ~]# egrep -v ' | + | [root@centos7 ~]# cat /etc/mongod.conf |
- | [root@centos7 ~]# cat / | + | systemLog: |
- | LoadModule access_compat_module modules/ | + | |
- | LoadModule actions_module modules/ | + | |
- | LoadModule alias_module modules/mod_alias.so | + | |
- | LoadModule allowmethods_module modules/mod_allowmethods.so | + | |
- | LoadModule auth_basic_module modules/mod_auth_basic.so | + | |
- | LoadModule auth_digest_module modules/mod_auth_digest.so | + | |
- | LoadModule authn_anon_module modules/ | + | |
- | LoadModule authn_core_module modules/ | + | |
- | LoadModule authn_dbd_module modules/ | + | |
- | LoadModule authn_dbm_module modules/ | + | |
- | LoadModule authn_file_module modules/ | + | |
- | LoadModule authn_socache_module modules/ | + | |
- | LoadModule authz_core_module modules/ | + | |
- | LoadModule authz_dbd_module modules/ | + | |
- | LoadModule authz_dbm_module modules/ | + | |
- | LoadModule authz_groupfile_module modules/ | + | |
- | LoadModule authz_host_module modules/ | + | |
- | LoadModule authz_owner_module modules/ | + | |
- | LoadModule authz_user_module modules/ | + | |
- | LoadModule autoindex_module modules/ | + | |
- | LoadModule cache_module modules/ | + | |
- | LoadModule cache_disk_module modules/ | + | |
- | LoadModule data_module modules/ | + | |
- | LoadModule dbd_module modules/ | + | |
- | LoadModule deflate_module modules/ | + | |
- | LoadModule dir_module modules/ | + | |
- | LoadModule dumpio_module modules/ | + | |
- | LoadModule echo_module modules/ | + | |
- | LoadModule env_module modules/ | + | |
- | LoadModule expires_module modules/ | + | |
- | LoadModule ext_filter_module modules/ | + | |
- | LoadModule filter_module modules/ | + | |
- | LoadModule headers_module modules/ | + | |
- | LoadModule include_module modules/ | + | |
- | LoadModule info_module modules/ | + | |
- | LoadModule log_config_module modules/ | + | |
- | LoadModule logio_module modules/ | + | |
- | LoadModule mime_magic_module modules/ | + | |
- | LoadModule mime_module modules/ | + | |
- | LoadModule negotiation_module modules/ | + | |
- | LoadModule remoteip_module modules/ | + | |
- | LoadModule reqtimeout_module modules/ | + | |
- | LoadModule rewrite_module modules/ | + | |
- | LoadModule setenvif_module modules/ | + | |
- | LoadModule slotmem_plain_module modules/ | + | |
- | LoadModule slotmem_shm_module modules/ | + | |
- | LoadModule socache_dbm_module modules/ | + | |
- | LoadModule socache_memcache_module modules/ | + | |
- | LoadModule socache_shmcb_module modules/ | + | |
- | LoadModule status_module modules/ | + | |
- | LoadModule substitute_module modules/ | + | |
- | LoadModule suexec_module modules/ | + | |
- | LoadModule unique_id_module modules/ | + | |
- | LoadModule unixd_module modules/ | + | |
- | LoadModule userdir_module modules/ | + | |
- | LoadModule version_module modules/ | + | |
- | LoadModule vhost_alias_module modules/ | + | |
- | </ | + | |
- | =====/etc/httpd/conf.d/ | + | storage: |
+ | dbPath: | ||
+ | journal: | ||
+ | enabled: true | ||
- | Afin de complémenter la configuration de base d' | + | processManagement: |
+ | fork: true # fork and run in background | ||
+ | pidFilePath: | ||
- | < | + | net: |
- | [root@centos7 ~]# vi / | + | port: 27017 |
- | [root@centos7 ~]# cat / | + | |
- | ServerTokens OS | + | |
- | Timeout 60 | + | |
- | KeepAlive Off | + | |
- | MaxKeepAliveRequests 100 | + | |
- | KeepAliveTimeout 15 | + | |
- | < | + | |
- | StartServers | + | |
- | MinSpareServers | + | |
- | MaxSpareServers | + | |
- | ServerLimit | + | |
- | MaxClients | + | |
- | MaxRequestsPerChild | + | |
- | </ | + | |
- | UseCanonicalName Off | + | |
- | AccessFileName .htaccess | + | |
- | HostnameLookups Off | + | |
- | ServerSignature On | + | |
- | AddLanguage ca .ca | + | |
- | AddLanguage cs .cz .cs | + | |
- | AddLanguage da .dk | + | |
- | AddLanguage de .de | + | |
- | AddLanguage el .el | + | |
- | AddLanguage en .en | + | |
- | AddLanguage eo .eo | + | |
- | AddLanguage es .es | + | |
- | AddLanguage et .et | + | |
- | AddLanguage fr .fr | + | |
- | AddLanguage he .he | + | |
- | AddLanguage hr .hr | + | |
- | AddLanguage it .it | + | |
- | AddLanguage ja .ja | + | |
- | AddLanguage ko .ko | + | |
- | AddLanguage ltz .ltz | + | |
- | AddLanguage nl .nl | + | |
- | AddLanguage nn .nn | + | |
- | AddLanguage no .no | + | |
- | AddLanguage pl .po | + | |
- | AddLanguage pt .pt | + | |
- | AddLanguage pt-BR .pt-br | + | |
- | AddLanguage ru .ru | + | |
- | AddLanguage sv .sv | + | |
- | AddLanguage zh-CN .zh-cn | + | |
- | AddLanguage zh-TW .zh-tw | + | |
- | AddHandler type-map var | + | |
- | LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | + | |
- | ForceLanguagePriority Prefer Fallback | + | |
- | BrowserMatch " | + | |
- | BrowserMatch "MSIE 4\.0b2;" | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch "MS FrontPage" | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch "^XML Spy" redirect-carefully | + | |
- | BrowserMatch " | + | |
- | ServerName www.i2tch.loc:80 | + | |
- | ExtendedStatus On | + | |
- | < | + | |
- | SetHandler server-status | + | |
- | Require ip 127.0.0.1 | + | |
- | </ | + | |
- | < | + | |
- | SetHandler server-info | + | |
- | Require ip 127.0.0.1 | + | |
- | </ | + | |
</ | </ | ||
- | ====Les Directives du fichier /etc/httpd/conf.d/local.conf==== | + | Dans ce fichier, sont notamment définit le lieu de stockage des données et des logs respectivement dans **/var/lib/mongo** et **/var/ |
- | Dans ce fichier on trouve les directives suivantes : | + | ====Le client Mongo==== |
- | ===ServerTokens=== | + | Une manipulation intéressante à faire consiste à modifier le prompt du client mongo pour afficher la base de donnée courante. Par défaut le prompt est minimaliste : |
- | Cette directive indique le contenu de l' | + | < |
- | < | + | Pour connaître le base de donnée sur laquelle on travaille il convient de de taper " |
- | ServerTokens OS | + | |
- | </ | + | |
- | ===Timeout=== | + | < |
+ | test | ||
+ | ></ | ||
- | Cette directive indique le nombre de secondes entre une requête et le timeout : | + | Créez donc le fichier |
- | + | ||
- | < | + | |
- | Timeout 60 | + | |
- | </ | + | |
- | + | ||
- | ===KeepAlive=== | + | |
- | + | ||
- | Cette directive interdit plusieurs requêtes par connexion : | + | |
- | + | ||
- | < | + | |
- | KeepAlive Off | + | |
- | </ | + | |
- | + | ||
- | ===MaxKeepAliveRequests=== | + | |
- | + | ||
- | Cette directive fixe le nombre maximum de requêtes par connexion ( 0 = infinie ) : | + | |
- | + | ||
- | < | + | |
- | MaxKeepAliveRequests 100 | + | |
- | </ | + | |
- | + | ||
- | ===KeepAliveTimeout=== | + | |
- | + | ||
- | Cette directive fixe le nombre de seconds d' | + | |
- | + | ||
- | < | + | |
- | KeepAliveTimeout 15 | + | |
- | </ | + | |
- | + | ||
- | ===StartServers, | + | |
- | + | ||
- | Ces directives contrôlent le nombre de processus serveur fils au lancement d' | + | |
- | + | ||
- | < | + | |
- | StartServers 8 | + | |
- | MinSpareServers 5 | + | |
- | MaxSpareServers 20 | + | |
- | </ | + | |
- | + | ||
- | ===ServerLimit=== | + | |
- | + | ||
- | Pour le module prefork, cette directive définie la valeur maximale de la directive **MaxRequestWorkers** (anciennement **MaxClients**) pour la durée de vie du processus Apache : | + | |
- | + | ||
- | < | + | |
- | ServerLimit 256 | + | |
- | </ | + | |
- | + | ||
- | ===MaxRequestWorkers=== | + | |
- | + | ||
- | Pour le module prefork, la directive **MaxRequestWorkers** indique le nombre maximal de processus fils qui seront lancés pour traiter les requêtes. Sa valeur par défaut est de 256 : | + | |
- | + | ||
- | < | + | |
- | MaxRequestWorkers 256 | + | |
- | </ | + | |
- | + | ||
- | ===MaxConnectionsPerChild=== | + | |
- | + | ||
- | La directive **MaxConnectionsPerChild** (anciennement **MaxRequestsPerChild**) fixe la limite du nombre de requêtes traitées par un processus fils avant que celui-ci expire. Si la valeur de **%%MaxRequestsPerChild%%** est 0, le processus n' | + | |
- | + | ||
- | < | + | |
- | MaxConnectionsPerChild 4000 | + | |
- | </ | + | |
- | + | ||
- | ===UseCanonicalName=== | + | |
- | + | ||
- | Cette directive indique a apache comment construire les variables SERVER_NAME et SERVER_PORT. Quand la directive est On, Apache utilise la valeur de la directive **%%ServerName%%**. Quand la directive est Off, Apache utilise les valeurs fournies par le navigateur du client : | + | |
- | + | ||
- | < | + | |
- | UseCanonicalName Off | + | |
- | </ | + | |
- | + | ||
- | ===AccessFileName=== | + | |
- | + | ||
- | Cette directive indique le nom des fichiers de permissions a utiliser avec le fichier | + | |
- | + | ||
- | < | + | |
- | AccessFileName .htaccess | + | |
- | </file> | + | |
- | + | ||
- | ===HostnameLookups=== | + | |
- | + | ||
- | Cette directive autorise (On) ou désactive (Off) la résolution DNS pour la trace d' | + | |
- | + | ||
- | < | + | |
- | HostnameLookups Off | + | |
- | </ | + | |
- | + | ||
- | ===ServerSignature=== | + | |
- | + | ||
- | Cette directive indique si la signature du serveur sera sur les pages d' | + | |
- | + | ||
- | < | + | |
- | ServerSignature On | + | |
- | </ | + | |
- | + | ||
- | ===AddLanguage=== | + | |
- | + | ||
- | La directive **%%AddLanguage%%** stipule l' | + | |
- | + | ||
- | < | + | |
- | AddLanguage ca .ca | + | |
- | AddLanguage cs .cz .cs | + | |
- | AddLanguage da .dk | + | |
- | AddLanguage de .de | + | |
- | AddLanguage el .el | + | |
- | AddLanguage en .en | + | |
- | AddLanguage eo .eo | + | |
- | AddLanguage es .es | + | |
- | AddLanguage et .et | + | |
- | AddLanguage fr .fr | + | |
- | AddLanguage he .he | + | |
- | AddLanguage hr .hr | + | |
- | AddLanguage it .it | + | |
- | AddLanguage ja .ja | + | |
- | AddLanguage ko .ko | + | |
- | AddLanguage ltz .ltz | + | |
- | AddLanguage nl .nl | + | |
- | AddLanguage nn .nn | + | |
- | AddLanguage no .no | + | |
- | AddLanguage pl .po | + | |
- | AddLanguage pt .pt | + | |
- | AddLanguage pt-BR .pt-br | + | |
- | AddLanguage ru .ru | + | |
- | AddLanguage sv .sv | + | |
- | AddLanguage zh-CN .zh-cn | + | |
- | AddLanguage zh-TW .zh-tw | + | |
- | </ | + | |
- | + | ||
- | ===LanguagePriority=== | + | |
- | + | ||
- | Le module **mod_negotiation** fournit la négociation de contenus et est inclus dans Apache par défaut. Il est ainsi possible d' | + | |
- | + | ||
- | * Réaliser un fichier *.var, une **Table de Types** qui précise les fichiers définissant les variantes, | + | |
- | * Utiliser une recherche **%%MultiViews%%**. | + | |
- | + | ||
- | Dans le cas de l' | + | |
- | + | ||
- | < | + | |
- | AddHandler type-map var | + | |
- | </ | + | |
- | + | ||
- | Pour plus d' | + | |
- | + | ||
- | La directive **%%LanguagePriority%%** indique une liste de langues à utiliser par ordre de priorité de gauche à droite. Cette priorité joue dans le cas où Apache trouve **deux** ou **plusieurs** versions satisfaisantes du même document. En effet c'est la directive **%%ForceLanguagePriority%%**, | + | |
- | + | ||
- | < | + | |
- | LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | + | |
- | ForceLanguagePriority Prefer Fallback | + | |
- | </ | + | |
- | + | ||
- | ===mod_setenvif=== | + | |
- | + | ||
- | **mod_setenvif** permet de définir des variables d' | + | |
- | + | ||
- | Le variable **downgrade-1.0** oblige Apache à traiter la requête comme du HTTP/1.0 même si elle a été construite sur une norme plus récente. | + | |
- | + | ||
- | Le variable **force-response-1.0**, | + | |
- | + | ||
- | Le variable **nokeepalive** désactive **Keep-Alive**, | + | |
- | + | ||
- | Le variable **redirect-carefully** rend le serveur plus attentif quand il doit envoyer une redirection au client. Cette variable est habituellement utilisée quand un client a un problème connu pour gérer les redirections. | + | |
- | + | ||
- | < | + | |
- | BrowserMatch " | + | |
- | BrowserMatch "MSIE 4\.0b2;" | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch "MS FrontPage" | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch " | + | |
- | BrowserMatch "^XML Spy" redirect-carefully | + | |
- | BrowserMatch " | + | |
- | </ | + | |
- | + | ||
- | ===ServerName=== | + | |
- | + | ||
- | Cette directive indique le nom du serveur. Décommentez cette directive et modifiez-la ainsi : | + | |
- | + | ||
- | < | + | |
- | ServerName www.i2tch.loc: | + | |
- | </ | + | |
- | + | ||
- | ===mod-status=== | + | |
- | + | ||
- | Ce module permet à l' | + | |
- | + | ||
- | < | + | |
- | ExtendedStatus On | + | |
- | + | ||
- | < | + | |
- | SetHandler server-status | + | |
- | Require ip 127.0.0.1 | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ===mod_info=== | + | |
- | + | ||
- | Ce module permet d' | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | SetHandler server-info | + | |
- | Require ip 127.0.0.1 | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | ====Application de la Configuration==== | + | |
- | + | ||
- | Editez le fichier **/ | + | |
- | + | ||
- | < | + | |
- | 10.0.2.15 | + | |
- | 10.0.2.15 | + | |
- | </ | + | |
- | + | ||
- | Re-démarrez le serveur httpd : | + | |
< | < | ||
- | [root@centos7 ~]# systemctl restart httpd | + | [root@centos7 ~]# vi $HOME/ |
- | [root@centos7 ~]# systemctl status httpd | + | [root@centos7 ~]# cat $HOME/.mongorc.js |
- | ● httpd.service - The Apache HTTP Server | + | prompt = function(){return db+"> |
- | | + | |
- | Active: active | + | |
- | Docs: man: | + | |
- | | + | |
- | Process: 17996 ExecStop=/ | + | |
- | Process: 21235 ExecReload=/ | + | |
- | Main PID: 18013 (httpd) | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | Aug 24 10:19:38 centos7.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | + | |
- | Aug 24 10:19:38 centos7.i2tch.loc systemd[1]: Started The Apache HTTP Server. | + | |
</ | </ | ||
- | =====Configuration sous Debian 8===== | + | Constatez que la base de données courante |
- | + | ||
- | Sous Debian 8 le fichier | + | |
< | < | ||
- | root@debian8:~# ls -l / | + | [root@centos7 |
- | total 80 | + | MongoDB shell version: 3.2.16 |
- | -rw-r--r-- 1 root root 7115 Mar 31 10:17 apache2.conf | + | connecting to: test |
- | drwxr-xr-x | + | Server has startup warnings: |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 conf-enabled | + | 2017-09-18T13:46:09.416+0200 I CONTROL |
- | -rw-r--r-- 1 root root 1782 Mar 31 10:17 envvars | + | 2017-09-18T13:46:09.416+0200 I CONTROL |
- | -rw-r--r-- 1 root root 31063 Mar 30 16:07 magic | + | test> |
- | drwxr-xr-x 2 root root 12288 Aug 27 11:08 mods-available | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 mods-enabled | + | |
- | -rw-r--r-- 1 root root 320 Mar 30 16:07 ports.conf | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-available | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-enabled | + | |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | / | + | |
- | total 80 | + | |
- | -rw-r--r-- 1 root root 7115 Mar 31 10:17 apache2.conf | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 conf-available | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 conf-enabled | + | |
- | -rw-r--r-- 1 root root 1782 Mar 31 10:17 envvars | + | |
- | -rw-r--r-- 1 root root 31063 Mar 30 16:07 magic | + | |
- | drwxr-xr-x 2 root root 12288 Aug 27 11:08 mods-available | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 mods-enabled | + | |
- | -rw-r--r-- 1 root root 320 Mar 30 16:07 ports.conf | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-available | + | |
- | drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-enabled | + | |
- | + | ||
- | / | + | |
- | total 24 | + | |
- | -rw-r--r-- 1 root root 315 Mar 30 16:07 charset.conf | + | |
- | -rw-r--r-- 1 root root 127 Jul 29 2013 javascript-common.conf | + | |
- | -rw-r--r-- 1 root root 3224 Mar 30 16:07 localized-error-pages.conf | + | |
- | -rw-r--r-- 1 root root 189 Mar 30 16:07 other-vhosts-access-log.conf | + | |
- | -rw-r--r-- 1 root root 2190 Mar 31 10:17 security.conf | + | |
- | -rw-r--r-- 1 root root 455 Mar 30 16:07 serve-cgi-bin.conf | + | |
- | + | ||
- | / | + | |
- | total 0 | + | |
- | lrwxrwxrwx 1 root root 30 Aug 27 11:08 charset.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 44 Aug 27 11:08 localized-error-pages.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 46 Aug 27 11:08 other-vhosts-access-log.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 31 Aug 27 11:08 security.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 36 Aug 27 11:08 serve-cgi-bin.conf -> ../ | + | |
- | + | ||
- | / | + | |
- | total 528 | + | |
- | -rw-r--r-- 1 root root 100 Mar 30 16:07 access_compat.load | + | |
- | -rw-r--r-- 1 root root 377 Mar 30 16:07 actions.conf | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 actions.load | + | |
- | -rw-r--r-- 1 root root 843 Mar 30 16:07 alias.conf | + | |
- | -rw-r--r-- 1 root root 62 Mar 30 16:07 alias.load | + | |
- | -rw-r--r-- 1 root root 76 Mar 30 16:07 allowmethods.load | + | |
- | -rw-r--r-- 1 root root 76 Mar 30 16:07 asis.load | + | |
- | -rw-r--r-- 1 root root 94 Mar 30 16:07 auth_basic.load | + | |
- | -rw-r--r-- 1 root root 96 Mar 30 16:07 auth_digest.load | + | |
- | -rw-r--r-- 1 root root 100 Mar 30 16:07 auth_form.load | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 authn_anon.load | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 authn_core.load | + | |
- | -rw-r--r-- 1 root root 85 Mar 30 16:07 authn_dbd.load | + | |
- | -rw-r--r-- 1 root root 70 Mar 30 16:07 authn_dbm.load | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 authn_file.load | + | |
- | -rw-r--r-- 1 root root 78 Mar 30 16:07 authn_socache.load | + | |
- | -rw-r--r-- 1 root root 74 Mar 30 16:07 authnz_fcgi.load | + | |
- | -rw-r--r-- 1 root root 90 Mar 30 16:07 authnz_ldap.load | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 authz_core.load | + | |
- | -rw-r--r-- 1 root root 96 Mar 30 16:07 authz_dbd.load | + | |
- | -rw-r--r-- 1 root root 92 Mar 30 16:07 authz_dbm.load | + | |
- | -rw-r--r-- 1 root root 104 Mar 30 16:07 authz_groupfile.load | + | |
- | -rw-r--r-- 1 root root 94 Mar 30 16:07 authz_host.load | + | |
- | -rw-r--r-- 1 root root 74 Mar 30 16:07 authz_owner.load | + | |
- | -rw-r--r-- 1 root root 94 Mar 30 16:07 authz_user.load | + | |
- | -rw-r--r-- 1 root root 3374 Mar 30 16:07 autoindex.conf | + | |
- | -rw-r--r-- 1 root root 70 Mar 30 16:07 autoindex.load | + | |
- | -rw-r--r-- 1 root root 64 Mar 30 16:07 buffer.load | + | |
- | -rw-r--r-- 1 root root 889 Mar 30 16:07 cache_disk.conf | + | |
- | -rw-r--r-- 1 root root 89 Mar 30 16:07 cache_disk.load | + | |
- | -rw-r--r-- 1 root root 62 Mar 30 16:07 cache.load | + | |
- | -rw-r--r-- 1 root root 95 Mar 30 16:07 cache_socache.load | + | |
- | -rw-r--r-- 1 root root 115 Mar 30 16:07 cgid.conf | + | |
- | -rw-r--r-- 1 root root 60 Mar 30 16:07 cgid.load | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 cgi.load | + | |
- | -rw-r--r-- 1 root root 76 Mar 30 16:07 charset_lite.load | + | |
- | -rw-r--r-- 1 root root 60 Mar 30 16:07 data.load | + | |
- | -rw-r--r-- 1 root root 83 Mar 30 16:07 dav_fs.conf | + | |
- | -rw-r--r-- 1 root root 79 Mar 30 16:07 dav_fs.load | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 dav.load | + | |
- | -rw-r--r-- 1 root root 68 Mar 30 16:07 dav_lock.load | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 dbd.load | + | |
- | -rw-r--r-- 1 root root 522 Mar 31 09:45 deflate.conf | + | |
- | -rw-r--r-- 1 root root 84 Mar 30 16:07 deflate.load | + | |
- | -rw-r--r-- 1 root root 64 Mar 30 16:07 dialup.load | + | |
- | -rw-r--r-- 1 root root 157 Mar 30 16:07 dir.conf | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 dir.load | + | |
- | -rw-r--r-- 1 root root 64 Mar 30 16:07 dump_io.load | + | |
- | -rw-r--r-- 1 root root 60 Mar 30 16:07 echo.load | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 env.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 expires.load | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 ext_filter.load | + | |
- | -rw-r--r-- 1 root root 89 Mar 30 16:07 file_cache.load | + | |
- | -rw-r--r-- 1 root root 64 Mar 30 16:07 filter.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 headers.load | + | |
- | -rw-r--r-- 1 root root 176 Mar 30 16:07 heartbeat.load | + | |
- | -rw-r--r-- 1 root root 182 Mar 30 16:07 heartmonitor.load | + | |
- | -rw-r--r-- 1 root root 62 Mar 30 16:07 ident.load | + | |
- | -rw-r--r-- 1 root root 82 Mar 30 16:07 include.load | + | |
- | -rw-r--r-- 1 root root 402 Mar 30 16:07 info.conf | + | |
- | -rw-r--r-- 1 root root 60 Mar 30 16:07 info.load | + | |
- | -rw-r--r-- 1 root root 116 Mar 30 16:07 lbmethod_bybusyness.load | + | |
- | -rw-r--r-- 1 root root 116 Mar 30 16:07 lbmethod_byrequests.load | + | |
- | -rw-r--r-- 1 root root 114 Mar 30 16:07 lbmethod_bytraffic.load | + | |
- | -rw-r--r-- 1 root root 114 Mar 30 16:07 lbmethod_heartbeat.load | + | |
- | -rw-r--r-- 1 root root 121 Mar 30 16:07 ldap.conf | + | |
- | -rw-r--r-- 1 root root 60 Mar 30 16:07 ldap.load | + | |
- | -rw-r--r-- 1 root root 70 Mar 30 16:07 log_debug.load | + | |
- | -rw-r--r-- 1 root root 76 Mar 30 16:07 log_forensic.load | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 lua.load | + | |
- | -rw-r--r-- 1 root root 62 Mar 30 16:07 macro.load | + | |
- | -rw-r--r-- 1 root root 7639 Mar 31 09:45 mime.conf | + | |
- | -rw-r--r-- 1 root root 60 Mar 30 16:07 mime.load | + | |
- | -rw-r--r-- 1 root root 120 Mar 30 16:07 mime_magic.conf | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 mime_magic.load | + | |
- | -rw-r--r-- 1 root root 668 Mar 30 16:07 mpm_event.conf | + | |
- | -rw-r--r-- 1 root root 106 Mar 30 16:07 mpm_event.load | + | |
- | -rw-r--r-- 1 root root 571 Mar 30 16:07 mpm_prefork.conf | + | |
- | -rw-r--r-- 1 root root 108 Mar 30 16:07 mpm_prefork.load | + | |
- | -rw-r--r-- 1 root root 836 Mar 30 16:07 mpm_worker.conf | + | |
- | -rw-r--r-- 1 root root 107 Mar 30 16:07 mpm_worker.load | + | |
- | -rw-r--r-- 1 root root 724 Mar 30 16:07 negotiation.conf | + | |
- | -rw-r--r-- 1 root root 74 Mar 30 16:07 negotiation.load | + | |
- | -rw-r--r-- 1 root root 87 Mar 30 16:07 proxy_ajp.load | + | |
- | -rw-r--r-- 1 root root 347 Mar 30 16:07 proxy_balancer.conf | + | |
- | -rw-r--r-- 1 root root 115 Mar 30 16:07 proxy_balancer.load | + | |
- | -rw-r--r-- 1 root root 822 Mar 30 16:07 proxy.conf | + | |
- | -rw-r--r-- 1 root root 95 Mar 30 16:07 proxy_connect.load | + | |
- | -rw-r--r-- 1 root root 95 Mar 30 16:07 proxy_express.load | + | |
- | -rw-r--r-- 1 root root 89 Mar 30 16:07 proxy_fcgi.load | + | |
- | -rw-r--r-- 1 root root 93 Mar 30 16:07 proxy_fdpass.load | + | |
- | -rw-r--r-- 1 root root 189 Mar 30 16:07 proxy_ftp.conf | + | |
- | -rw-r--r-- 1 root root 87 Mar 30 16:07 proxy_ftp.load | + | |
- | -rw-r--r-- 1 root root 2511 Mar 30 16:07 proxy_html.conf | + | |
- | -rw-r--r-- 1 root root 89 Mar 31 10:17 proxy_html.load | + | |
- | -rw-r--r-- 1 root root 89 Mar 30 16:07 proxy_http.load | + | |
- | -rw-r--r-- 1 root root 62 Mar 30 16:07 proxy.load | + | |
- | -rw-r--r-- 1 root root 89 Mar 30 16:07 proxy_scgi.load | + | |
- | -rw-r--r-- 1 root root 97 Mar 30 16:07 proxy_wstunnel.load | + | |
- | -rw-r--r-- 1 root root 85 Mar 30 16:07 ratelimit.load | + | |
- | -rw-r--r-- 1 root root 70 Mar 30 16:07 reflector.load | + | |
- | -rw-r--r-- 1 root root 68 Mar 30 16:07 remoteip.load | + | |
- | -rw-r--r-- 1 root root 1190 Mar 30 16:07 reqtimeout.conf | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 reqtimeout.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 request.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 rewrite.load | + | |
- | -rw-r--r-- 1 root root 58 Mar 30 16:07 sed.load | + | |
- | -rw-r--r-- 1 root root 99 Mar 30 16:07 session_cookie.load | + | |
- | -rw-r--r-- 1 root root 99 Mar 30 16:07 session_crypto.load | + | |
- | -rw-r--r-- 1 root root 93 Mar 30 16:07 session_dbd.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 session.load | + | |
- | -rw-r--r-- 1 root root 1280 Mar 30 16:07 setenvif.conf | + | |
- | -rw-r--r-- 1 root root 68 Mar 30 16:07 setenvif.load | + | |
- | -rw-r--r-- 1 root root 78 Mar 30 16:07 slotmem_plain.load | + | |
- | -rw-r--r-- 1 root root 74 Mar 30 16:07 slotmem_shm.load | + | |
- | -rw-r--r-- 1 root root 74 Mar 30 16:07 socache_dbm.load | + | |
- | -rw-r--r-- 1 root root 84 Mar 30 16:07 socache_memcache.load | + | |
- | -rw-r--r-- 1 root root 78 Mar 30 16:07 socache_shmcb.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 speling.load | + | |
- | -rw-r--r-- 1 root root 3110 Mar 30 16:07 ssl.conf | + | |
- | -rw-r--r-- 1 root root 97 Mar 30 16:07 ssl.load | + | |
- | -rw-r--r-- 1 root root 749 Mar 30 16:07 status.conf | + | |
- | -rw-r--r-- 1 root root 64 Mar 30 16:07 status.load | + | |
- | -rw-r--r-- 1 root root 72 Mar 30 16:07 substitute.load | + | |
- | -rw-r--r-- 1 root root 64 Mar 30 16:07 suexec.load | + | |
- | -rw-r--r-- 1 root root 70 Mar 30 16:07 unique_id.load | + | |
- | -rw-r--r-- 1 root root 423 Mar 31 10:17 userdir.conf | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 userdir.load | + | |
- | -rw-r--r-- 1 root root 70 Mar 30 16:07 usertrack.load | + | |
- | -rw-r--r-- 1 root root 74 Mar 30 16:07 vhost_alias.load | + | |
- | -rw-r--r-- 1 root root 66 Mar 30 16:07 xml2enc.load | + | |
- | + | ||
- | / | + | |
- | total 0 | + | |
- | lrwxrwxrwx 1 root root 36 Aug 27 11:08 access_compat.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 28 Aug 27 11:08 alias.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 28 Aug 27 11:08 alias.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 auth_basic.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 authn_core.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 authn_file.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 authz_core.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 authz_host.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 authz_user.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 32 Aug 27 11:08 autoindex.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 32 Aug 27 11:08 autoindex.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 30 Aug 27 11:08 deflate.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 30 Aug 27 11:08 deflate.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 26 Aug 27 11:08 dir.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 26 Aug 27 11:08 dir.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 26 Aug 27 11:08 env.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 29 Aug 27 11:08 filter.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 27 Aug 27 11:08 mime.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 27 Aug 27 11:08 mime.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 32 Aug 27 11:08 mpm_event.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 32 Aug 27 11:08 mpm_event.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 34 Aug 27 11:08 negotiation.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 34 Aug 27 11:08 negotiation.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 reqtimeout.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 11:08 reqtimeout.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 31 Aug 27 11:08 setenvif.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 31 Aug 27 11:08 setenvif.load -> ../ | + | |
- | lrwxrwxrwx 1 root root 29 Aug 27 11:08 status.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 29 Aug 27 11:08 status.load -> ../ | + | |
- | + | ||
- | / | + | |
- | total 12 | + | |
- | -rw-r--r-- 1 root root 1332 Mar 30 16:07 000-default.conf | + | |
- | -rw-r--r-- 1 root root 6437 Mar 31 10:17 default-ssl.conf | + | |
- | + | ||
- | / | + | |
- | total 0 | + | |
- | lrwxrwxrwx 1 root root 35 Aug 27 11:08 000-default.conf -> ../ | + | |
</ | </ | ||
- | ===/ | + | ====Autres Clients Mongodb==== |
- | < | + | ===Interfaces graphiques=== |
- | root@debian8: | + | |
- | # This is the main Apache server configuration file. It contains the | + | |
- | # configuration directives that give the server its instructions. | + | |
- | # See http:// | + | |
- | # the directives and / | + | |
- | # hints. | + | |
- | # | + | |
- | # | + | |
- | # Summary of how the Apache 2 configuration works in Debian: | + | |
- | # The Apache 2 web server configuration in Debian is quite different to | + | |
- | # upstream' | + | |
- | # default Apache2 installation attempts to make adding and removing modules, | + | |
- | # virtual hosts, and extra configuration directives as flexible as possible, in | + | |
- | # order to make automating the changes and administering the server as easy as | + | |
- | # possible. | + | |
- | # It is split into several files forming the configuration hierarchy outlined | + | ==RoboMongo== |
- | # below, all located in the / | + | |
- | # | + | |
- | # | + | |
- | # |-- apache2.conf | + | |
- | # | + | |
- | # |-- mods-enabled | + | |
- | # | |-- *.load | + | |
- | # | `-- *.conf | + | |
- | # |-- conf-enabled | + | |
- | # | `-- *.conf | + | |
- | # `-- sites-enabled | + | |
- | # `-- *.conf | + | |
- | # | + | |
- | # | + | |
- | # * apache2.conf is the main configuration file (this file). It puts the pieces | + | |
- | # | + | |
- | # web server. | + | |
- | # | + | |
- | # * ports.conf is always included from the main configuration file. It is | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # * Configuration files in the mods-enabled/, | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # They are activated by symlinking available configuration files from their | + | |
- | # | + | |
- | # | + | |
- | # their respective man pages for detailed information. | + | |
- | # | + | |
- | # * The binary is called apache2. Due to the use of environment variables, in | + | |
- | # the default configuration, | + | |
- | # / | + | |
- | # work with the default configuration. | + | |
+ | **RoboMongo** est un client graphique disponible pour toutes les plate-formes sur le site **[[https:// | ||
- | # Global configuration | + | {{ : |
- | # | + | |
- | # | + | <WRAP center round important> |
- | # ServerRoot: The top of the directory tree under which the server' | + | **A Faire** - Installez RoboMongo et connectez-vous à MongoDB. |
- | # configuration, | + | </WRAP> |
- | # | + | |
- | # NOTE! If you intend to place this on an NFS (or otherwise network) | + | |
- | # mounted filesystem then please read the Mutex documentation (available | + | |
- | # at <URL:http:// | + | |
- | # you will save yourself a lot of trouble. | + | |
- | # | + | |
- | # Do NOT add a slash at the end of the directory path. | + | |
- | # | + | |
- | #ServerRoot "/ | + | |
- | # | + | ==RockMongo== |
- | # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. | + | |
- | # | + | |
- | Mutex file: | + | |
- | # | + | **RockMongo** est une application PHP disponible sur le site **[[http://www.rockmongo.com]]** et qui nécessite un serveur Apache/PHP. De plus, il est nécessaire d’installer l’extension PHP de connexion à MongoDB. |
- | # PidFile: The file in which the server should record its process | + | |
- | # identification number when it starts. | + | |
- | # This needs to be set in /etc/apache2/envvars | + | |
- | # | + | |
- | PidFile ${APACHE_PID_FILE} | + | |
- | # | + | {{ :elearning: |
- | # Timeout: The number of seconds before receives and sends time out. | + | |
- | # | + | |
- | Timeout 300 | + | |
- | # | + | ==Genghis== |
- | # KeepAlive: Whether or not to allow persistent connections (more than | + | |
- | # one request per connection). Set to " | + | |
- | # | + | |
- | KeepAlive On | + | |
- | # | + | **Genghis** est une interface d' |
- | # MaxKeepAliveRequests: The maximum number of requests to allow | + | |
- | # during a persistent connection. Set to 0 to allow an unlimited amount. | + | |
- | # We recommend you leave this number high, for maximum performance. | + | |
- | # | + | |
- | MaxKeepAliveRequests 100 | + | |
- | # | + | {{ :elearning: |
- | # KeepAliveTimeout: Number of seconds to wait for the next request from the | + | |
- | # same client on the same connection. | + | |
- | # | + | |
- | KeepAliveTimeout 5 | + | |
+ | ====Les API pour MongoDB (Application Programming Interface)==== | ||
- | # These need to be set in / | + | ===Pour le langage Java=== |
- | User ${APACHE_RUN_USER} | + | |
- | Group ${APACHE_RUN_GROUP} | + | |
- | # | + | **Java-MongoDB-Driver** est le pilote Java pris en charge pour MongoDB |
- | # HostnameLookups: Log the names of clients or just their IP addresses | + | |
- | # e.g., www.apache.org (on) or 204.62.129.132 (off). | + | |
- | # The default is off because it'd be overall better for the net if people | + | |
- | # had to knowingly turn this feature on, since enabling it means that | + | |
- | # each client request will result in AT LEAST one lookup request to the | + | |
- | # nameserver. | + | |
- | # | + | |
- | HostnameLookups Off | + | |
- | # ErrorLog: The location of the error log file. | + | * **com.mongodb** - il s'agit du paquet de base permettant de créer une connexion client à une instance en cours d' exécution mongod |
- | # If you do not specify an ErrorLog directive within a < | + | * **com.mongodb.client** - ce paquet permet l' |
- | # container, error messages relating to that virtual host will be | + | |
- | # logged here. If you *do* define an error logfile for a < | + | |
- | # container, that host's errors will be logged there and not here. | + | |
- | # | + | |
- | ErrorLog ${APACHE_LOG_DIR}/ | + | |
- | # | + | On se connecte à une instance MongoDB en cours d' exécution sur le localhost (port par défaut 27017) |
- | # LogLevel: Control the severity of messages logged to the error_log. | + | |
- | # Available values: trace8, ..., trace1, debug, info, notice, warn, | + | |
- | # error, crit, alert, emerg. | + | |
- | # It is also possible to configure the log level for particular modules, e.g. | + | |
- | # " | + | |
- | # | + | |
- | LogLevel warn | + | |
- | # Include module configuration: | + | Pour gérer les documents dans l' |
- | IncludeOptional mods-enabled/ | + | |
- | IncludeOptional mods-enabled/ | + | |
- | # Include list of ports to listen on | + | * org.bson.Document |
- | Include ports.conf | + | * com.mongodb.MongoClient |
+ | * com.mongodb.client.MongoCollection | ||
+ | * com.mongodb.client.MongoDatabase | ||
+ | ===Pour le langage C++=== | ||
- | # Sets the default security model of the Apache2 HTTPD server. It does | + | **mongo-cxx-driver** permet de se connecter à une instance mongod et de créer une connexion client à une instance en cours d' |
- | # not allow access to the root filesystem outside of /usr/share and /var/www. | + | |
- | # The former is used by web applications packaged in Debian, | + | |
- | # the latter may be used for local directories served by the web server. If | + | |
- | # your system is serving content from a sub-directory in /srv you must allow | + | |
- | # access here, or in any related virtual host. | + | |
- | < | + | |
- | Options FollowSymLinks | + | |
- | AllowOverride None | + | |
- | Require all denied | + | |
- | </ | + | |
- | < | + | * **La librairie bsoncxx** permet de gérer les documents. |
- | AllowOverride None | + | |
- | Require all granted | + | |
- | </ | + | |
- | < | + | Pour gérer les applications, |
- | Options Indexes FollowSymLinks | + | |
- | AllowOverride None | + | |
- | Require all granted | + | |
- | </ | + | |
- | #< | + | =====Structure des Données===== |
- | # Options Indexes FollowSymLinks | + | |
- | # | + | |
- | # Require all granted | + | |
- | #</ | + | |
+ | ====Notions de Documents==== | ||
+ | On associe les documents aux bases de données orientées documents qui sont destinées aux applications qui gèrent des documents. Ce type de bases de données peut être ou non une sur-couche d'une base de données relationnelle. | ||
+ | Dans un système de base de données relationnelles, | ||
- | # AccessFileName: | + | MongoDB ne nécessite donc pas de schéma prédéfini comme en SQL, il n'est pas nécessaire par exemple de définir des colonnes avec un nom et un type et on peut insérer n' |
- | # for additional configuration directives. See also the AllowOverride | + | |
- | # directive. | + | |
- | # | + | |
- | AccessFileName | + | |
- | # | + | De plus, contrairement aux bases de données SQL, il n'est pas nécessaire de faire des requêtes avec des jointures pour connaitre des informations. Dans MongoDb, il suffit de lire le document qui nous intéresse, d'où l' |
- | # The following lines prevent | + | |
- | # viewed by Web clients. | + | |
- | # | + | |
- | < | + | |
- | Require all denied | + | |
- | </ | + | |
+ | ====Notions de Collections==== | ||
- | # | + | Le terme collection est issu du monde NoSQL et correspond par analogie à la notion de table dans les bases de données relationnelles |
- | # The following directives define some format nicknames for use with | + | |
- | # a CustomLog directive. | + | |
- | # | + | |
- | # These deviate from the Common Log Format definitions in that they use %O | + | |
- | # (the actual bytes sent including headers) instead of %b (the size of the | + | |
- | # requested file), because the latter makes it impossible to detect partial | + | |
- | # requests. | + | |
- | # | + | |
- | # Note that the use of %{X-Forwarded-For}i instead of %h is not recommended. | + | |
- | # Use mod_remoteip instead. | + | |
- | # | + | |
- | LogFormat "%v:%p %h %l %u %t \" | + | |
- | LogFormat "%h %l %u %t \" | + | |
- | LogFormat "%h %l %u %t \" | + | |
- | LogFormat " | + | |
- | LogFormat " | + | |
- | # Include of directories ignores editors' | + | En comparant le schéma de structure d'une base de MongoDB à celui d'une base de donnée relationelle comme SQL, on peut faire le parallèle suivant: |
- | # see README.Debian for details. | + | |
- | # Include generic snippets of statements | + | ^ Base de données relationnelle (SQL) ^ Base de données NoSQL (MongoDB) ^ |
- | IncludeOptional conf-enabled/ | + | | database |
+ | | table | collection | ||
+ | | row | document où document BSON | | ||
+ | | column | ||
+ | | index | index | | ||
+ | | primary key | primary key | | ||
- | # Include the virtual host configurations: | + | Pour avoir un apercu, on peut définir par exemple 2 documents comme ceci: |
- | IncludeOptional sites-enabled/ | + | |
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
- | </ | + | |
- | + | ||
- | ===/ | + | |
< | < | ||
- | root@debian8:~# cat / | + | {_id: " |
- | # Read the documentation before enabling AddDefaultCharset. | + | {_id: " |
- | # In general, it is only a good idea if you know that all your files | + | |
- | # have this encoding. It will override any encoding given in the files | + | |
- | # in meta http-equiv or xml encoding tags. | + | |
- | + | ||
- | # | + | |
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
</ | </ | ||
- | ===/ | + | Dans l' |
- | < | + | ====Le Format JSON==== |
- | root@debian8: | + | |
- | # Customizable error responses come in three flavors: | + | |
- | # 1) plain text | + | |
- | # 2) local redirects | + | |
- | # 3) external redirects | + | |
- | # | + | |
- | # Some examples: | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | JSON, ou **[[https://fr.wikipedia.org/wiki/JavaScript_Object_Notation|JavaScript Object Notation]]**, est un format de données textuelles dérivé de la notation des objets du langage JavaScript. Il permet de représenter de l’information structurée. |
- | # Putting this all together, we can internationalize error responses. | + | |
- | # | + | |
- | # We use Alias to redirect any / | + | |
- | # our collection of by-error message multi-language collections. | + | |
- | # includes to substitute the appropriate text. | + | |
- | # | + | |
- | # You can modify the messages' | + | |
- | # default HTTP_< | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # which allows you to create your own set of files by starting with the | + | |
- | # / | + | |
- | # even on a per-VirtualHost basis. If you include the Alias in the global server | + | |
- | # context, is has to come _before_ the 'Alias / | + | |
- | # | + | |
- | # The default include files will display your Apache version number and your | + | |
- | # ServerAdmin email address regardless of the setting of ServerSignature. | + | |
- | # | + | |
- | # WARNING: The configuration below will NOT work out of the box if you have a | + | |
- | # SetHandler directive in a < | + | |
- | # the following three lines AFTER the < | + | |
- | # make it work in most cases: | + | |
- | # < | + | |
- | # SetHandler none | + | |
- | # </ | + | |
- | # | + | |
- | # The internationalized error documents require mod_alias, mod_include | + | |
- | # and mod_negotiation. To activate them, uncomment the following 37 lines. | + | |
- | #< | + | Un document JSON a pour fonction de représenter de l' |
- | # | + | |
- | # | + | |
- | # | + | |
- | # Alias /error/ "/ | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # Order allow,deny | + | |
- | # Allow from all | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | #</ | + | |
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | Ce format se base donc sur 2 types d' |
- | </ | + | |
- | ===/etc/ | + | * la paire clé/valeur, par exemple " |
+ | * le tableau, par exemple " | ||
- | < | + | ====Le Format BSON==== |
- | root@debian8: | + | |
- | # Define an access log for VirtualHosts that don't define their own logfile | + | |
- | CustomLog ${APACHE_LOG_DIR}/ | + | |
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | Le format BSON ou **[[https:// |
- | </code> | + | |
- | ===/etc/ | + | ===Comparaison BSON/JSON=== |
- | < | + | Voici un tableau comparatif de BSON ET JSON : |
- | root@debian8:~# cat / | + | |
- | # | + | |
- | # Disable access to the entire file system except for the directories that | + | |
- | # are explicitly allowed later. | + | |
- | # | + | |
- | # This currently breaks the configurations that come with some web application | + | |
- | # Debian packages. | + | |
- | # | + | |
- | #< | + | |
- | # | + | |
- | # Order Deny, | + | |
- | # Deny from all | + | |
- | #</ | + | |
+ | ^ Comparaison BSON/ | ||
+ | ^ Type de Champs ^ JSON ^ BSON ^ | ||
+ | | Number | ||
+ | | String | ||
+ | | Boolean | ||
+ | | Array | X | X | | ||
+ | | Object | ||
+ | | Null | X | X | | ||
+ | | Float | - | X | | ||
+ | | Date | - | X | | ||
+ | | Regular Expression | ||
+ | | JavaScript Code | - | X | | ||
- | # Changing the following options will not really affect the security of the | + | On constate que le format BSON supporte plus de types que le format JSON. Le codage BSON complète la représentation JSON en y ajoutant des types de données supplémentaires, tels que les formats virgule flottante ou date entre autres. |
- | # server, but might make attacks slightly more difficult in some cases. | + | |
- | # | + | ===Format d'un Document BSON=== |
- | # ServerTokens | + | |
- | # This directive configures what you return as the Server HTTP response | + | |
- | # Header. The default is 'Full' which sends information about the OS-Type | + | |
- | # and compiled in modules. | + | |
- | # Set to one of: Full | OS | Minimal | Minor | Major | Prod | + | |
- | # where Full conveys the most information, | + | |
- | # | + | |
- | ServerTokens OS | + | |
- | # | + | |
- | # | + | Dernièrement, voici un document au format BSON stockant des informations concernant un film : |
- | # Optionally add a line containing the server version and virtual host | + | |
- | # name to server-generated pages (internal error documents, FTP directory | + | |
- | # listings, mod_status and mod_info output etc., but not CGI generated | + | |
- | # documents or custom error documents). | + | |
- | # Set to " | + | |
- | # Set to one of: On | Off | EMail | + | |
- | # | + | |
- | ServerSignature On | + | |
- | # | + | < |
- | # Allow TRACE method | + | "_id": " |
- | # | + | |
- | # Set to "extended" | + | " |
- | # diagnostic purposes). | + | programming genius Mark Zuckerberg sits down at his |
- | # | + | |
- | # Set to one of: On | Off | extended | + | " |
- | TraceEnable Off | + | " |
- | # | + | "first_name": " |
- | + | " | |
- | # | + | |
- | # Forbid access to version control directories | + | |
- | # | + | ] |
- | # If you use version control systems | + | } |
- | # probably deny access to their directories. For example, for subversion: | + | |
- | # | + | |
- | #< | + | |
- | # | + | |
- | #</ | + | |
- | + | ||
- | # | + | |
- | # Setting this header will prevent MSIE from interpreting files as something | + | |
- | # else than declared by the content type in the HTTP headers. | + | |
- | # Requires mod_headers to be enabled. | + | |
- | # | + | |
- | #Header set X-Content-Type-Options: "nosniff" | + | |
- | + | ||
- | # | + | |
- | # Setting this header will prevent other sites from embedding pages from this | + | |
- | # site as frames. This defends against clickjacking attacks. | + | |
- | # Requires mod_headers to be enabled. | + | |
- | # | + | |
- | #Header set X-Frame-Options: "sameorigin" | + | |
- | + | ||
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
</ | </ | ||
- | ===/ | + | =====Le Langage des Requêtes===== |
- | < | + | ====Requêtes de base==== |
- | root@debian8: | + | |
- | < | + | |
- | < | + | |
- | Define ENABLE_USR_LIB_CGI_BIN | + | |
- | </ | + | |
- | < | + | ===Se placer dans une base de données/Créer une base de données=== |
- | Define ENABLE_USR_LIB_CGI_BIN | + | |
- | </IfModule> | + | |
- | < | + | Pour se placer dans une base de données ou créer une base inexistente, |
- | ScriptAlias /cgi-bin/ / | + | |
- | < | + | |
- | AllowOverride None | + | |
- | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | < |
- | </ | + | |
- | ===/ | + | ===Créer une collection=== |
- | <code> | + | Pour créer une collection, il convient d' |
- | root@debian8:~# cat / | + | |
- | # envvars - default environment variables for apache2ctl | + | |
- | # this won't be correct after changing uid | + | < |
- | unset HOME | + | |
- | # for supporting multiple apache2 instances | + | <WRAP center round important> |
- | if [ " | + | **Important** |
- | SUFFIX=" | + | </WRAP> |
- | else | + | |
- | SUFFIX= | + | |
- | fi | + | |
- | # Since there is no sane way to get the parsed apache2 config in scripts, some | + | ===Visualiser la liste des collections=== |
- | # settings are defined via environment variables and then used in apache2ctl, | + | |
- | # / | + | |
- | export APACHE_RUN_USER=www-data | + | |
- | export APACHE_RUN_GROUP=www-data | + | |
- | # temporary state file location. This might be changed to /run in Wheezy+1 | + | |
- | export APACHE_PID_FILE=/ | + | |
- | export APACHE_RUN_DIR=/ | + | |
- | export APACHE_LOCK_DIR=/ | + | |
- | # Only / | + | |
- | export APACHE_LOG_DIR=/ | + | |
- | ## The locale used by some modules like mod_dav | + | Pour visualiser la liste des collections, |
- | export LANG=C | + | |
- | ## Uncomment the following line to use the system default locale instead: | + | |
- | #. / | + | |
- | export LANG | + | < |
- | ## The command to get the status for ' | + | ===Inserer un document BSON dans une collection=== |
- | ## Some packages providing ' | + | |
- | #export APACHE_LYNX=' | + | |
- | ## If you need a higher file descriptor limit, uncomment and adjust the | + | Pour inserer un document BSON dans une collection, il convient d' |
- | ## following line (default is 8192): | + | |
- | # | + | |
- | ## If you would like to pass arguments to the web server, add them below | + | < |
- | ## to the APACHE_ARGUMENTS environment. | + | db.movies.insert ({" |
- | #export APACHE_ARGUMENTS='' | + | db.movies.insert ({" |
- | + | ||
- | ## Enable the debug mode for maintainer scripts. | + | |
- | ## This will produce a verbose output on package installations of web server modules and web application | + | |
- | ## installations which interact with Apache | + | |
- | #export APACHE2_MAINTSCRIPT_DEBUG=1 | + | |
</ | </ | ||
- | ===/etc/ | + | <WRAP center round important> |
+ | **Important** - Notez que la structure du deuxième document n’a rien à voir avec le premier. Il n’y a pas de schéma (et donc pas de contrainte) dans MongoDB. On est libre de tout faire, ce qui revient à reporter les problèmes (contrôles, | ||
+ | </WRAP> | ||
- | < | + | ===Affecter un identifiant explicitement=== |
- | root@debian8: | + | |
- | # Magic data for mod_mime_magic (originally for file(1) command) | + | |
- | # | + | |
- | # The format is 4-5 columns: | + | |
- | # Column #1: byte number to begin checking from, ">" | + | |
- | # Column #2: type of data to match | + | |
- | # Column #3: contents of data to match | + | |
- | # Column #4: MIME type of result | + | |
- | # Column #5: MIME encoding of result (optional) | + | |
- | # | + | Pour affecter un identifiant explicitement, |
- | # Localstuff: | + | |
- | # Add any locally observed files here. | + | |
- | # Real Audio (Magic .ra\0375) | + | < |
- | 0 belong 0x2e7261fd audio/x-pn-realaudio | + | |
- | 0 string .RMF application/ | + | |
- | # | + | ===Remplacer un document=== |
- | # | + | |
- | # | + | |
- | # sigh, there are many mimes for that but the above are the most common. | + | |
- | # Taken from magic, converted to magic.mime | + | Pour remplacer un document, il convient d' |
- | # mime types according to http://www.geocities.com/ | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # Taken from loader | + | <code> db.movies.update( { "title": "Mr Smith" }, { " |
- | # by Steve McIntyre | + | |
- | # < | + | |
- | 0 string MAS_UTrack_V00 | + | |
- | > | + | |
- | # | + | |
- | --More--(4%) | + | |
- | </ | + | |
- | ===/ | + | ===Modifier des champs d’un document=== |
- | <code> | + | Pour modifier des champs d’un document, il convient d' |
- | root@debian8: | + | |
- | # If you just change the port or add more ports here, you will likely also | + | |
- | # have to change the VirtualHost statement in | + | |
- | # / | + | |
- | Listen 80 | + | < |
- | < | + | ===Compter le nombre de documents dans la collection=== |
- | Listen 443 | + | |
- | </ | + | |
- | < | + | Pour compter le nombre de documents dans la collection, il convient d' |
- | Listen 443 | + | |
- | </IfModule> | + | |
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | < |
- | </ | + | |
- | =====Administration de Base===== | + | ===Supprimer un document=== |
- | ==== LAB #1 - Gestion de serveurs virtuels ==== | + | Pour supprimer un ou plusieurs documents il convient d' |
- | Apache est capable de gérer de multiples sites hébergés sur la même machine. | + | < |
- | Il existe deux façons de créer des sites ( hôtes ) virtuels : | + | ===Supprimer un champ dans un document=== |
- | | + | Pour supprimer un champ dans un document, il convient d' |
- | | + | |
- | ===Sous RHEL / CentOS 7=== | + | < |
- | Sous **RHEL / CentOS 7** ceci est rendu possible par un fichier de configuration spécifique appelé: **/ | + | ===Supprimer une collection=== |
- | <code> | + | Pour supprimer une collection, il convient d' |
- | [root@centos7 ~]# mkdir / | + | |
- | </ | + | |
- | Créez ensuite le fichier **/ | + | < |
- | < | + | ===Trier des documents=== |
- | [root@centos7 ~]# touch / | + | |
- | </ | + | |
- | Le contenu de fichier est inclus à l' | + | Pour trier les documents, il convient |
- | <file> | + | <code> db.movies.find ().sort({"title": 1}).skip(9).limit(12) |
- | ... | + | |
- | # Supplemental configuration | + | |
- | # | + | |
- | # Load config files in the "/ | + | |
- | IncludeOptional conf.d/ | + | |
- | Include conf/ | + | |
- | </file> | + | |
- | Ajoutez donc cette ligne au fichier | + | <WRAP center round important> |
+ | **Important** - Notez qu' | ||
+ | </ | ||
- | ==Hôte virtuel par nom== | + | ===Rechercher des documents dans une collection=== |
- | Nous allons | + | Pour afficher les contenu |
- | Créez un répertoire **/www/site1 **à la racine de votre arborescence pour héberger notre premier hôte virtuel : | + | < |
- | < | + | On obtient des objets (javascript, |
- | [root@centos7 ~]# mkdir -p / | + | |
- | </ | + | |
- | Créez ensuite le fichier **index.html** du répertoire **/ | + | < |
- | <code> | + | <WRAP center round important> |
- | [root@centos7 ~]# vi / | + | **Important** - Notez que MongoDB associe un identifiant unique à chaque document, de nom conventionnel **_id**, et lui attribue une valeur si elle n’est pas indiquée explicitement. |
- | [root@centos7 ~]# cat / | + | </WRAP> |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | </code> | + | |
- | Editez le fichier **/ | + | Il est aussi possible de rechercher |
- | < | + | < |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | ################# | + | |
- | NameVirtualHost *:80 | + | |
- | ################## | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | ServerName i2tch.loc | + | |
- | ServerAlias www.i2tch.loc | + | |
- | </ | + | |
- | ################## | + | |
- | < | + | |
- | ServerName www.rhelnom.com | + | |
- | DirectoryIndex index.html | + | |
- | DocumentRoot / | + | |
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | <WRAP center round important> | + | ou en utilisant n’importe quel attribut |
- | **Important** | + | |
- | </ | + | |
- | Redémarrez ensuite le serveur Apache | + | < |
- | < | + | ====Projections==== |
- | [root@centos7 ~]# systemctl restart httpd | + | |
- | </ | + | |
- | Avant de pouvoir consulter le site virtuel, il faut renseigner votre fichier **/ | + | Les requêtes précédentes ramènent l’intégralité des objets satisfaisant les critères |
- | < | + | < |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | 127.0.0.1 localhost.localdomain localhost | + | |
- | ::1 localhost6.localdomain6 localhost6 | + | |
- | 10.0.2.15 i2tch.loc | + | |
- | 10.0.2.15 | + | |
- | 10.0.2.15 www.rhelnom.com | + | |
- | </ | + | |
- | Sauvegardez votre fichier hosts et installez | + | Le second argument est un objet BSON dont les attributs sont ceux à conserver dans le résultat. La valeur des attributs dans cet objet-projection ne prend que deux interprétations. Toute valeur autre que **0** ou **null** indique que l’attribut doit être conservé. Si on choisit au contraire d’indiquer les attributs à exclure, on leur donne la valeur **0** ou **null**. Par exemple, la requête suivante retourne les films sans les acteurs et sans le résumé |
- | < | + | < |
- | [root@centos7 ~]# yum install lynx | + | |
- | </ | + | |
- | Testez votre configuration avec **lynx** : | + | ====Opérateurs ensemblistes==== |
- | < | + | Les opérateurs du langage SQL **in**, **not in**, **any** et **all** se retrouvent dans le langage d’interrogation. La différence, |
- | [root@centos7 ~]# lynx --dump http://www.rhelnom.com | + | |
- | Accueil du site 1 | + | |
+ | Par exemple, on cherche les films dans lesquels joue au moins un des artistes dans une liste dont on connaît l’identifiant : | ||
- | [root@centos7 ~]# | + | < |
- | </ | + | |
- | Afin de mieux comprendre les visites à notre site virtuel, nous avons besoin d'un fichier log ainsi qu'un fichier de log des erreurs. Ouvrez donc le fichier | + | Le **not in** correspond à l’opérateur $nin. |
- | <file> | + | <code> db.artists.find({" |
- | Customlog / | + | |
- | Errorlog / | + | |
- | </file> | + | |
- | Vous obtiendrez une fenêtre similaire à celle-ci | + | Comme dernier example, voici comment trouver les films qui n’ont pas d’attribut summary |
- | < | + | < |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | ################# | + | |
- | NameVirtualHost *:80 | + | |
- | ################## | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | ServerName i2tch.loc | + | |
- | ServerAlias www.i2tch.loc | + | |
- | </ | + | |
- | ################## | + | |
- | < | + | |
- | ServerName www.rhelnom.com | + | |
- | DirectoryIndex index.html | + | |
- | DocumentRoot / | + | |
- | Customlog / | + | |
- | Errorlog / | + | |
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | Créez ensuite le répertoire / | + | ====Opérateurs booléens==== |
- | < | + | Par défaut, quand on exprime plusieurs critères, c’est une conjonction (and) qui est appliquée. On peut l’indiquer explicitement. Voici la syntaxe (les films tournés avec Leonardo DiCaprio en 1997) : |
- | [root@centos7 ~]# mkdir -p / | + | |
- | </ | + | |
- | Redémarrez le serveur Apache | + | < |
- | < | + | L’opérateur **and** s’applique à un tableau de conditions. Bien entendu il existe un opérateur **or** avec la même syntaxe. Les films parus en 1997 ou avec Leonardo DiCaprio : |
- | [root@centos7 ~]# systemctl restart httpd | + | |
- | </ | + | |
- | Testez votre configuration avec **lynx** | + | < |
- | < | + | ====Comparaison de la structure des requêtes entre SQL/MongoDB==== |
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | Accueil du site 1 | + | |
+ | ===Tables/ | ||
- | [root@centos7 ~]# | + | ==CREATE TABLE== |
- | </ | + | |
- | Contrôlez maintenant le contenu du répertoire **/www/ | + | ^ SQL ^ MongoDB |
+ | | < | ||
+ | age Number, status char(1), PRIMARY KEY (id))</code> |< | ||
- | < | + | ==DROP TABLE== |
- | [root@centos7 ~]# ls -l / | + | |
- | total 4 | + | |
- | -rw-r--r--. 1 root root 0 Aug 24 11:06 rhelnom_error.log | + | |
- | -rw-r--r--. 1 root root 138 Aug 24 11:06 rhelnom.log | + | |
- | </ | + | |
- | Ces deux fichiers **rhelnom.log** et **rhelnom_error.log** sont créés automatiquement par Apache. | + | ^ SQL ^ MongoDB |
+ | | < | ||
- | En contrôlant le contenu du fichier **/ | + | ==ALTER TABLE== |
- | < | + | ^ SQL ^ MongoDB |
- | [root@centos7 ~]# cat /www/ | + | | < |
- | 10.0.2.15 - - [24/ | + | | < |
- | </ | + | |
- | ==Hôte virtuel par adresse IP== | + | ==CREATE INDEX== |
- | Commencez par créer une adresse IP fixe : | + | ^ SQL ^ MongoDB |
+ | | < | ||
+ | | < | ||
- | < | + | ===Rows/documents=== |
- | [root@centos7 ~]# nmcli connection add con-name ip_fixe ifname enp0s3 type ethernet ip4 10.0.2.16/24 gw4 10.0.2.2 | + | |
- | [root@centos7 ~]# nmcli connection up ip_fixe | + | |
- | [root@centos7 ~]# nmcli connection mod ip_fixe ipv4.dns 8.8.8.8 | + | |
- | [root@centos7 ~]# systemctl restart NetworkManager | + | |
- | [root@centos7 ~]# nslookup www.free.fr | + | |
- | Server: | + | |
- | Address: | + | |
- | Non-authoritative answer: | + | ==INSERT== |
- | Name: | + | |
- | Address: 212.27.48.10 | + | |
- | </ | + | |
- | Avant de pouvoir consulter les sites virtuel, il faut modifier votre fichier **/etc/ | + | ^ SQL ^ MongoDB |
+ | | < | ||
- | < | + | ==SELECT== |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | 127.0.0.1 localhost.localdomain localhost | + | |
- | :: | + | |
- | 10.0.2.16 i2tch.loc | + | |
- | 10.0.2.16 | + | |
- | 10.0.2.16 www.rhelnom.com | + | |
- | </ | + | |
- | Vous allez maintenant procéder à la création d'un site ( hôte ) virtuel par adresse IP. Normalement, votre serveur serait muni de deux cartes réseaux permettant ainsi d' | + | ^ SQL ^ MongoDB |
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
- | < | + | ==EXPLAIN SELECT== |
- | [root@centos7 ~]# ip a | grep 'inet ' | + | |
- | inet 127.0.0.1/8 scope host lo | + | |
- | inet 10.0.2.16/ | + | |
- | [root@centos7 ~]# ip a add 192.168.1.99/ | + | |
- | [root@centos7 ~]# ip a | grep 'inet ' | + | |
- | inet 127.0.0.1/8 scope host lo | + | |
- | inet 10.0.2.16/ | + | |
- | inet 192.168.1.99/ | + | |
- | </ | + | |
- | Créez maintenant le répertoire pour notre site2 : | + | ^ SQL ^ MongoDB |
+ | | < | ||
- | < | + | ==UPDATE== |
- | [root@centos7 ~]# mkdir / | + | |
- | </ | + | |
- | Créez la page d' | + | ^ SQL ^ MongoDB |
+ | | < | ||
+ | | < | ||
- | < | + | ==DELETE FROM== |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | Créez ensuite le répertoire | + | ^ SQL ^ MongoDB |
+ | | < | ||
+ | | < | ||
- | < | ||
- | [root@centos7 ~]# mkdir / | ||
- | </ | ||
- | Editez maintenant le fichier **/ | + | =====LAB #1 - Utilisation de requêtes de base===== |
- | < | + | ====Création |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | ################# | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | ServerName www.rhelip.com | + | |
- | DirectoryIndex index.html | + | |
- | Customlog / | + | |
- | Errorlog / | + | |
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | ################# | + | |
- | NameVirtualHost *:80 | + | |
- | ################## | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | ServerName i2tch.loc | + | |
- | ServerAlias www.i2tch.loc | + | |
- | </ | + | |
- | ################## | + | |
- | < | + | |
- | ServerName www.rhelnom.com | + | |
- | DirectoryIndex index.html | + | |
- | DocumentRoot / | + | |
- | Customlog / | + | |
- | Errorlog / | + | |
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | Éditez ensuite le fichier **/ | + | Commencez par créer une collection nommé Movies qui enregistre des informations sur des films : |
< | < | ||
- | [root@centos7 ~]# vi / | + | test>db.createCollection(" |
- | [root@centos7 ~]# cat / | + | { " |
- | 127.0.0.1 localhost.localdomain localhost | + | test> |
- | ::1 localhost6.localdomain6 localhost6 | + | |
- | 10.0.2.16 i2tch.loc | + | |
- | 10.0.2.16 www.i2tch.loc | + | |
- | 10.0.2.16 | + | |
- | 192.168.1.99 | + | |
</ | </ | ||
- | Redémarrez votre serveur Apache : | + | ====Création de documents==== |
- | < | + | Créez maintenant les documents de la collection |
- | [root@centos7 ~]# systemctl restart httpd | + | |
- | </ | + | |
- | + | ||
- | Testez votre configuration avec **lynx** | + | |
< | < | ||
- | [root@centos7 ~]# lynx --dump http://www.rhelip.com | + | test> |
- | Accueil du site 2 | + | WriteResult({ " |
- | + | test>db.movies.insert({ " | |
- | + | WriteResult({ " | |
- | [root@centos7 ~]# | + | test> |
+ | WriteResult({ " | ||
+ | test> | ||
+ | WriteResult({ " | ||
+ | test> | ||
+ | WriteResult({ " | ||
+ | test> | ||
</ | </ | ||
- | Consultez maintenant le répertoire | + | <WRAP center round important> |
+ | **Important** - Notez que vous avez rentré 2 fois le nom et prénom du champ acteurs | ||
+ | </ | ||
- | < | + | ====Recherche de documents==== |
- | total 4 | + | |
- | -rw-r--r--. 1 root root 0 Aug 24 14:28 rhelip_error.log | + | |
- | -rw-r--r--. 1 root root 141 Aug 24 14:29 rhelip.log | + | |
- | </ | + | |
- | ==Hôtes Virtuels Dynamiques avec mod_vhost_alias== | + | Utilisez maintenant la commande find pour vérifier que les 5 documents ont bien été crées dans la collection movies |
- | + | ||
- | Commencez par installer le paquet **dnsmasq** afin de fournir | + | |
< | < | ||
- | [root@centos7 ~]# yum install dnsmasq | + | test> |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | test> | ||
</ | </ | ||
- | Créez | + | Modifiez ensuite |
< | < | ||
- | [root@centos7 ~]# vi / | + | test>db.movies.update({" |
- | [root@centos7 ~]# cat / | + | WriteResult({ " |
- | listen-address=127.0.0.1 | + | test> |
- | address=/ | + | |
</ | </ | ||
- | Re-démarrez | + | <WRAP center round important> |
+ | **Important** | ||
+ | </ | ||
- | < | + | Vérifiez |
- | [root@centos7 ~]# systemctl restart dnsmasq | + | |
- | </ | + | |
- | + | ||
- | Pour qu' | + | |
< | < | ||
- | [root@centos7 ~]# cat / | + | test>db.movies.find() |
- | LoadModule rewrite_module modules/ | + | { " |
- | [root@centos7 ~]# cat / | + | { " |
- | LoadModule alias_module modules/ | + | { " |
- | LoadModule vhost_alias_module modules/ | + | { " |
+ | { " | ||
+ | test> | ||
</ | </ | ||
- | Editez maintenant la section | + | <WRAP center round important> |
+ | **Important** - Notez que le titre du film ayant pour **" | ||
+ | </WRAP> | ||
- | < | + | Affichez maintenant les films n'ayant pas de réalisateur |
- | [root@centos7 ~]# vi / | + | |
- | [root@centos7 ~]# cat / | + | |
- | ################# | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | ServerName www.rhelip.com | + | |
- | DirectoryIndex index.html | + | |
- | Customlog / | + | |
- | Errorlog / | + | |
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | ################# | + | |
- | NameVirtualHost *:80 | + | |
- | ################## | + | |
- | < | + | |
- | VirtualDocumentRoot / | + | |
- | ServerName i2tch.loc | + | |
- | ServerAlias *.i2tch.loc | + | |
- | ServerAdmin webmaster@localhost | + | |
- | LogLevel info | + | |
- | < | + | |
- | Options FollowSymLinks | + | |
- | AllowOverride All | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | ################## | + | |
- | < | + | |
- | ServerName www.rhelnom.com | + | |
- | DirectoryIndex index.html | + | |
- | DocumentRoot / | + | |
- | Customlog / | + | |
- | Errorlog / | + | |
- | < | + | |
- | Require all granted | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | Créez le fichier **/ | + | |
< | < | ||
- | [root@centos7 ~]# vi / | + | test> |
- | [root@centos7 ~]# cat / | + | { " |
- | RewriteEngine On | + | { " |
- | RewriteBase / | + | { " |
+ | { " | ||
+ | test> | ||
</ | </ | ||
- | Re-démarrez le serveur httpd : | + | ====Suppression d'un document==== |
- | < | + | Supprimez |
- | [root@centos7 ~]# systemctl restart httpd | + | |
- | </ | + | |
- | + | ||
- | Creéz maintenant | + | |
< | < | ||
- | [root@centos7 ~]# mkdir / | + | test> |
+ | WriteResult({ " | ||
+ | test> | ||
</ | </ | ||
- | Créez | + | Constatez le résultat de la requête |
< | < | ||
- | [root@centos7 ~]# vi / | + | test> |
- | [root@centos7 ~]# cat / | + | { " |
- | < | + | { " |
- | < | + | { " |
- | < | + | { " |
- | </ | + | test> |
- | </html> | + | |
</ | </ | ||
- | Créez deux sites **projecta** et **projectb** : | + | Supprimez maintenant les films ayant **" |
< | < | ||
- | [root@centos7 ~]# mkdir / | + | test>db.movies.remove({" |
- | [root@centos7 ~]# vi / | + | WriteResult({ " |
- | [root@centos7 ~]# cat / | + | test>db.movies.find() |
- | < | + | { " |
- | <body> | + | { " |
- | < | + | |
- | </ | + | |
- | </ | + | |
</ | </ | ||
- | <code> | + | <WRAP center round important> |
- | [root@centos7 ~]# mkdir / | + | **Important** - Notez la suppression de deux documents : **" |
- | [root@centos7 ~]# vi / | + | </WRAP> |
- | [root@centos7 ~]# cat / | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | </code> | + | |
- | Modifiez l' | + | =====LAB #2 - Rechercher, filtrer |
- | < | + | ====La Requête find()==== |
- | root@debian8: | + | |
- | </ | + | |
- | Modifiez | + | Connectez-vous à MongoDB en utilisant |
< | < | ||
- | [root@centos7 ~]# vi /etc/ | + | [trainee@centos7 ~]$ su - |
- | [root@centos7 ~]# cat /etc/resolv.conf | + | Mot de passe : fenestros |
- | # Generated by NetworkManager | + | Dernière connexion : lundi 18 septembre 2017 à 13:39:03 CEST sur pts/0 |
- | search i2tch.loc | + | [root@centos7 ~]# mongo |
- | nameserver 127.0.0.1 | + | MongoDB shell version: 3.2.16 |
- | nameserver 8.8.8.8 | + | connecting to: test |
+ | Server has startup warnings: | ||
+ | 2017-09-18T13: | ||
+ | 2017-09-18T13: | ||
+ | test> | ||
</ | </ | ||
- | Testez que vous avez accès aux hôtes virtuels | + | Commencez par créer une base de données appelée **find** |
< | < | ||
- | [root@centos7 ~]# lynx --dump http:// | + | test>use find |
- | | + | switched to db find |
- | + | find> | |
- | + | ||
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | Accueil du site 2 | + | |
- | + | ||
- | + | ||
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | | + | |
- | + | ||
- | + | ||
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | Accueil du Project A | + | |
- | + | ||
- | + | ||
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | Accueil du Project A | + | |
- | + | ||
- | + | ||
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | Not Found | + | |
- | + | ||
- | The requested URL / was not found on this server. | + | |
</ | </ | ||
- | ===Sous Debian 8=== | + | ===Critères de recherche=== |
- | ==Hôte virtuel par nom== | + | En sachant |
- | + | ||
- | Sous **Debian 8** la configuration des hôtes virtuels ne se fait pas de la même façon | + | |
< | < | ||
- | root@debian8: | + | find> |
- | root@debian8: | + | WriteResult({ |
- | < | + | |
- | ServerName debiannom.com | + | |
- | ServerAlias www.debiannom.com | + | |
- | + | ||
- | ServerAdmin webmaster@localhost | + | |
- | DocumentRoot / | + | |
- | + | ||
- | < | + | |
- | AllowOverride None | + | |
- | Require all granted | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
</ | </ | ||
- | Créez un répertoire | + | Saisissez maintenant la commande |
< | < | ||
- | root@debian8:~# mkdir -p /www/site1 | + | find> |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | find> | ||
</ | </ | ||
- | Créez ensuite le fichier | + | Notez l' |
< | < | ||
- | root@debian8:~# vi / | + | find> |
- | root@debian8:~# cat / | + | { " |
- | < | + | { " |
- | < | + | { " |
- | < | + | { " |
- | < | + | { " |
- | < | + | { " |
- | </ | + | { " |
- | </html> | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | find> | ||
</ | </ | ||
<WRAP center round important> | <WRAP center round important> | ||
- | **Important** | + | **Important** |
</ | </ | ||
- | Modifiez l' | + | Tapez maintenat la commande |
< | < | ||
- | root@debian8:/ | + | find> |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | find> | ||
</ | </ | ||
- | Créez ensuite un lien symbolique dans le répertoire | + | <WRAP center round important> |
+ | **Important** - Vous obtenez les documents qui correspondent à **tenthousand = 9999**. | ||
+ | </WRAP> | ||
- | < | + | Précisez maintenant un deuxième critère de recherche |
- | root@debian8: | + | |
- | root@debian8:/ | + | |
- | root@debian8:/ | + | |
- | total 0 | + | |
- | lrwxrwxrwx 1 root root 35 Aug 27 11:08 000-default.conf -> ../ | + | |
- | lrwxrwxrwx 1 root root 33 Aug 27 18:32 debiannom.conf -> ../ | + | |
- | </ | + | |
- | + | ||
- | Redémarrez ensuite le serveur Apache | + | |
< | < | ||
- | root@debian8:/ | + | find> |
+ | { " | ||
+ | find> | ||
</ | </ | ||
- | Avant de pouvoir consulter le site virtuel, il faut renseigner votre fichier | + | <WRAP center round important> |
+ | **Important** - Vous obtenez un seul document où counter=19999 et tenthousand=9999. | ||
+ | </ | ||
- | < | + | Pour connaître |
- | root@debian8:/ | + | |
- | root@debian8:/ | + | |
- | 127.0.0.1 localhost | + | |
- | 127.0.1.1 debian8.i2tch.loc debian8 | + | |
- | + | ||
- | # The following lines are desirable for IPv6 capable hosts | + | |
- | ::1 | + | |
- | ff02::1 ip6-allnodes | + | |
- | ff02::2 ip6-allrouters | + | |
- | 10.0.2.15 i2tch.loc | + | |
- | 10.0.2.15 | + | |
- | 10.0.2.15 www.debiannom.com | + | |
- | </ | + | |
- | + | ||
- | Sauvegardez votre fichier hosts et installez | + | |
< | < | ||
- | root@debian8:/ | + | find> |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | find> | ||
+ | 100 | ||
+ | find> | ||
</ | </ | ||
- | Testez votre configuration avec **lynx** : | + | <WRAP center round important> |
+ | **Important** - Notez qu'il existe **100** documents correspondant à notre critère **({thousand:289, hundred: | ||
+ | </ | ||
- | < | + | ===Utiliser des Opérandes=== |
- | root@debian8:/ | + | |
- | Accueil du site 1 | + | |
+ | Il est possilible d' | ||
- | root@debian8:/ | + | ^ Opérande |
- | </ | + | | $gt | Supérieur à | |
+ | | $gte | Supérieur ou égal à | | ||
+ | | $lt | Inférieur à | | ||
+ | | $lte | Inférieur ou égal à | | ||
- | Afin de mieux comprendre les visites à notre site virtuel, nous avons besoin d'un fichier log ainsi qu'un fichier de log des erreurs. Ouvrez donc le fichier **/ | ||
- | <file> | + | <WRAP center round important> |
- | Customlog / | + | **Important** |
- | Errorlog / | + | </WRAP> |
- | </ | + | |
- | + | ||
- | Vous obtiendrez une fenêtre similaire à celle-ci : | + | |
- | + | ||
- | <file text debiannom.conf> | + | |
- | < | + | |
- | ServerName debiannom.com | + | |
- | | + | |
- | + | ||
- | ServerAdmin webmaster@localhost | + | |
- | DocumentRoot / | + | |
- | + | ||
- | Customlog / | + | |
- | Errorlog / | + | |
- | + | ||
- | < | + | |
- | AllowOverride None | + | |
- | Require all granted | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
- | </file> | + | |
- | Créez ensuite | + | Par exemple |
< | < | ||
- | root@debian8:/ | + | find> |
+ | 42500 | ||
+ | find> | ||
</ | </ | ||
- | Modifiez l' | + | ====Filtrer les champs==== |
- | < | + | Saisissez la requête **db.products.find({tenthousand: 525})** |
- | root@debian8:/ | + | |
- | </ | + | |
- | + | ||
- | Redémarrez le serveur Apache | + | |
< | < | ||
- | root@debian8:/ | + | find> |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | find> | ||
</ | </ | ||
- | Testez votre configuration avec **lynx** | + | Ajoutez maintenant un deuxième paramètre destiné à filtrer les champs retournés par la requête |
< | < | ||
- | root@debian8:/ | + | find>db.products.find({tenthousand: |
- | Accueil du site 1 | + | { " |
- | + | { " | |
- | + | { " | |
- | root@debian8:/ | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | find> | ||
</ | </ | ||
- | Contrôlez maintenant le contenu du répertoire | + | <WRAP center round important> |
- | + | **Important** - Notez que vous n'avez plus que les champs | |
- | < | + | </ |
- | root@debian8:/ | + | |
- | total 4 | + | |
- | -rw-r--r-- 1 root root 0 Aug 27 19:34 debiannom_error.log | + | |
- | -rw-r--r-- 1 root root 131 Aug 27 19:35 debiannom.log | + | |
- | </ | + | |
- | + | ||
- | Ces deux fichiers | + | |
- | En contrôlant le contenu du fichier | + | Saisissez donc la requête suivante qui indique que celle-ci ne doit **pas** retournée |
< | < | ||
- | root@debian8:/ | + | find>db.products.find({tenthousand: |
- | 10.0.2.15 - - [27/ | + | { " |
+ | { " | ||
+ | { "counter" | ||
+ | { "counter" | ||
+ | { "counter" | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | find> | ||
</ | </ | ||
- | ==Hôte virtuel par adresse IP== | + | ====Trier===== |
- | NetworkManager inclus | + | Saissisez |
- | + | ||
- | Si vous constatez que vous n'avez pas de profil dans la sortie de la commande **nmcli c show**, ceci indique que NetworkManager ne gère pas la carte : | + | |
< | < | ||
- | root@debian8:/ | + | find> |
- | root@debian8:~# nmcli c show | + | { " |
- | NAME | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | find> | ||
</ | </ | ||
- | Dans ce cas, le fichier | + | <WRAP center round important> |
+ | **Important** - Notez que le résultat démontre | ||
+ | </ | ||
- | < | + | Triez maintenant les résultats sur la valeur |
- | root@debian8: | + | |
- | # This file describes the network interfaces available on your system | + | |
- | # and how to activate them. For more information, | + | |
- | + | ||
- | source / | + | |
- | + | ||
- | # The loopback network interface | + | |
- | auto lo | + | |
- | iface lo inet loopback | + | |
- | + | ||
- | # The primary network interface | + | |
- | allow-hotplug eth0 | + | |
- | iface eth0 inet dhcp | + | |
- | </ | + | |
- | + | ||
- | Afin de permettre NetworkManager de gérer la carte malgré cette configuration, | + | |
< | < | ||
- | root@debian8:~# vi / | + | find> |
- | root@debian8:~# cat / | + | { " |
- | [main] | + | { " |
- | plugins=ifupdown,keyfile | + | { " |
- | + | { " | |
- | [ifupdown] | + | { " |
- | managed=true | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | find> | ||
</ | </ | ||
- | Il faut ensuite re-démarrer | + | Dernièrement, |
< | < | ||
- | root@debian8:~# systemctl restart NetworkManager.service | + | find> |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | find> | ||
</ | </ | ||
- | Constatez | + | =====LAB #3 - Requêtes sur la base movies===== |
- | < | + | ====Préparation==== |
- | root@debian8: | + | |
- | NAME | + | |
- | eth0 | + | |
- | Ifupdown (eth0) | + | |
- | </ | + | |
- | Créez maintenant un profil IP fixe rattaché | + | Sortez du client mongo, puis télécharger à partir de la section Fichiers de ce cours le fichier |
- | < | + | * movies.json |
- | root@debian8: | + | * ce fichier contient la liste de films complets comprenant tous les noms et prénoms des artistes, répétés à chaque occurrence. |
- | Connection ' | + | |
- | </ | + | |
- | Constatez sa présence : | + | ===Création de base de données=== |
- | < | + | Connectez-vous à MongoDB avec le client |
- | root@debian8: | + | |
- | NAME | + | |
- | ip_fixe | + | |
- | eth0 | + | |
- | Ifupdown (eth0) | + | |
- | </ | + | |
- | + | ||
- | L' | + | |
< | < | ||
- | root@debian8:~# cat / | + | [root@centos7 |
- | [connection] | + | MongoDB shell version: 3.2.16 |
- | id=ip_fixe | + | connecting to: test |
- | uuid=0421e288-cb7c-4569-ac1f-70598a13c96f | + | Server has startup warnings: |
- | interface-name=eth0 | + | 2017-09-19T11: |
- | type=ethernet | + | 2017-09-19T11: |
- | + | test>use movies | |
- | [ipv4] | + | switched to db movies |
- | method=manual | + | movies> |
- | address1=10.0.2.16/24,10.0.2.2 | + | { " |
+ | movies> | ||
+ | bye | ||
</ | </ | ||
- | Activez la connexion ip_fixe : | + | ===Importer les données=== |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | </ | + | |
- | Ajoutez le DNS 8.8.8.8 au profil | + | Utilisez maintenant la commande |
< | < | ||
- | root@debian8:~# nmcli connection mod ip_fixe ipv4.dns 8.8.8.8 | + | [root@centos7 |
+ | 2017-09-20T11: | ||
+ | 2017-09-20T11: | ||
</ | </ | ||
- | L' | + | <WRAP center round important> |
+ | **Important** - Notez que l’argument jsonArray indique à mongoimport qu’il s’agit d’un tableau d’objets à créer individuellement, | ||
+ | </ | ||
- | < | + | Re-connectez-vous à MongoDB |
- | root@debian8: | + | |
- | [connection] | + | |
- | id=ip_fixe | + | |
- | uuid=0421e288-cb7c-4569-ac1f-70598a13c96f | + | |
- | interface-name=eth0 | + | |
- | type=ethernet | + | |
- | + | ||
- | [ipv6] | + | |
- | method=auto | + | |
- | + | ||
- | [ipv4] | + | |
- | method=manual | + | |
- | dns=8.8.8.8; | + | |
- | address1=10.0.2.16/ | + | |
- | </ | + | |
- | + | ||
- | Afin que la modification du serveur DNS soit prise en compte, re-démarrez | + | |
< | < | ||
- | root@debian8:~# systemctl restart NetworkManager.service | + | [root@centos7 |
- | root@debian8:~# | + | MongoDB shell version: 3.2.16 |
- | root@debian8: | + | connecting to: test |
- | ● NetworkManager.service - Network Manager | + | Server has startup warnings: |
- | | + | 2017-09-19T11:51:43.992+0200 I CONTROL |
- | | + | 2017-09-19T11:51:43.992+0200 I CONTROL |
- | Main PID: 32570 (NetworkManager) | + | test> |
- | CGroup: / | + | |
- | └─32570 / | + | |
- | + | ||
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: < | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: < | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:16 debian8 NetworkManager[32570]: | + | |
- | Aug 27 20:04:22 debian8 NetworkManager[32570]: | + | |
</ | </ | ||
- | Vérifiez | + | En utilisant |
< | < | ||
- | root@debian8: | + | movies> |
- | PING www.free.fr | + | 88 |
- | 64 bytes from www.free.fr (212.27.48.10): | + | |
- | 64 bytes from www.free.fr (212.27.48.10): | + | |
- | 64 bytes from www.free.fr (212.27.48.10): | + | |
- | 64 bytes from www.free.fr (212.27.48.10): | + | |
- | ^C | + | |
- | --- www.free.fr ping statistics --- | + | |
- | 4 packets transmitted, | + | |
- | rtt min/ | + | |
</ | </ | ||
- | Avant de pouvoir consulter les sites virtuels existants, il faut modifier votre fichier **/ | + | ====Exercices==== |
- | < | + | Trouvez maintenant les informations suivantes |
- | root@debian8:/ | + | |
- | root@debian8:/ | + | |
- | 127.0.0.1 localhost | + | |
- | 127.0.1.1 debian8.i2tch.loc debian8 | + | |
- | # The following lines are desirable for IPv6 capable hosts | + | * tous les titres, |
- | ::1 | + | * le résumé de Spider-Man, |
- | ff02::1 ip6-allnodes | + | * le metteur en scène de Gladiator, |
- | ff02::2 ip6-allrouters | + | * les titres des films avec Kirsten Dunst, |
- | 10.0.2.16 i2tch.loc | + | * les films ayant un résumé, |
- | 10.0.2.16 | + | * les films qui ne sont ni des drames ni des comédies, |
- | 10.0.2.16 www.debiannom.com | + | * les titres des films et les noms des acteurs, |
- | </ | + | * les films où Clint Eastwood est acteur mais pas réalisateur. |
- | Vous allez maintenant procéder à la création d'un site ( hôte ) virtuel par adresse IP. Normalement, | ||
- | < | ||
- | root@debian8: | ||
- | inet 127.0.0.1/8 scope host lo | ||
- | inet 10.0.2.15/ | ||
- | root@debian8: | ||
- | root@debian8: | ||
- | inet 127.0.0.1/8 scope host lo | ||
- | inet 10.0.2.15/ | ||
- | inet 192.168.1.99/ | ||
- | </ | ||
- | Créez maintenant le répertoire pour notre site2 : | + | ===Corrigés=== |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | </ | + | |
- | Créez la page d' | + | ==Tous les titres== |
< | < | ||
- | root@debian8: | + | movies> |
- | root@debian8:~# cat / | + | { " |
- | < | + | { " |
- | < | + | { " |
- | < | + | { " |
- | </body> | + | { " |
- | </html> | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
+ | movies> | ||
</ | </ | ||
- | Créez ensuite le répertoire / | + | ==Le résumé de Spider-Man== |
< | < | ||
- | root@debian8:~# mkdir / | + | movies> |
+ | { " | ||
</ | </ | ||
- | Modifiez l' | + | ==Le metteur en scène de Gladiator== |
< | < | ||
- | root@debian8:~# chown -R www-data:www-data /www | + | movies> |
+ | { " | ||
</ | </ | ||
- | Copiez le fichier **/ | + | ==Les titres des films avec Kirsten Dunst== |
< | < | ||
- | root@debian8: | + | movies> |
+ | { " | ||
</ | </ | ||
- | Editez maintenant le fichier **/ | + | ==Les films ayant un résumé== |
< | < | ||
- | root@debian8: | + | movies> |
- | root@debian8: | + | { " |
- | < | + | { " |
- | ServerName debianip.com | + | { " |
- | ServerAlias www.debianip.com | + | { " |
- | + | { " | |
- | ServerAdmin webmaster@localhost | + | { " |
- | DocumentRoot | + | { " |
- | + | { " | |
- | Customlog / | + | { " |
- | Errorlog / | + | { "_id" |
- | + | { " | |
- | < | + | { " |
- | | + | { " |
- | | + | { " |
- | </ | + | { " |
- | + | { " | |
- | </ | + | { " |
- | + | { " | |
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | { " |
+ | { " | ||
+ | Type " | ||
</ | </ | ||
- | Créez le lien symbolique pour activer le site : | + | ==Les films qui ne sont ni des drames ni des comédies== |
< | < | ||
- | root@debian8:~# cd / | + | movies> |
- | root@debian8:/etc/ | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
</ | </ | ||
- | Éditez ensuite le fichier **/ | + | ==Les titres des films et les noms des acteurs== |
< | < | ||
- | root@debian8:/ | + | movies> |
- | root@debian8:/ | + | { " |
- | 127.0.0.1 localhost | + | { " |
- | 127.0.1.1 debian8.i2tch.loc debian8 | + | { " |
- | + | { " | |
- | # The following lines are desirable for IPv6 capable hosts | + | { " |
- | ::1 | + | { " |
- | ff02::1 ip6-allnodes | + | { " |
- | ff02::2 ip6-allrouters | + | { " |
- | 10.0.2.16 i2tch.loc | + | { " |
- | 10.0.2.16 | + | { " |
- | 10.0.2.16 www.debiannom.com | + | { " |
- | 192.168.1.99 www.debianip.com | + | { " |
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | { " | ||
+ | Type " | ||
</ | </ | ||
- | Redémarrez votre serveur Apache : | + | ==Les films où Clint Eastwood est acteur mais pas réalisateur== |
< | < | ||
- | root@debian8:/ | + | movies> |
+ | { " | ||
</ | </ | ||
- | Testez votre configuration avec **lynx** : | ||
- | < | ||
- | root@debian8:/ | ||
- | Accueil du site 2 | ||
- | root@debian8:/ | + | =====LAB |
- | </ | + | |
- | Consultez maintenant le répertoire **/ | + | ====Préparation==== |
- | < | + | Sortez du client mongo, puis téléchargez à partir de la section Fichiers de ce cours les deux fichiers au format JSON dont nous aurons besoin pour ce LAB : |
- | root@debian8:/ | + | |
- | total 4 | + | |
- | -rw-r--r-- 1 root root 0 Aug 27 22:14 debianip_error.log | + | |
- | -rw-r--r-- 1 root root 134 Aug 27 22:17 debianip.log | + | |
- | root@debian8:/ | + | |
- | 192.168.1.99 - - [27/ | + | |
- | </ | + | |
- | ==Hôtes Virtuels Dynamiques | + | * movies_ref.json |
+ | * ce fichier contient la liste des films avec références, | ||
+ | * artists.json | ||
+ | * ce fichier contient la liste des artistes. | ||
- | Commencez par installer le paquet **dnsmasq** afin de fournir les services d'un serveur DNS : | + | ===Création des bases de données=== |
- | + | ||
- | < | + | |
- | root@debian8:/ | + | |
- | root@debian8: | + | |
- | </ | + | |
- | Créez | + | Connectez-vous à MongoDB avec le client |
< | < | ||
- | root@debian8:~# vi / | + | [root@centos7 |
- | root@debian8:~# cat / | + | MongoDB shell version: 3.2.16 |
- | listen-address=127.0.0.1 | + | connecting to: test |
- | address=/.i2tch.loc/127.0.0.1 | + | Server has startup warnings: |
+ | 2017-09-19T11: | ||
+ | 2017-09-19T11: | ||
+ | movies> | ||
+ | switched to db moviesref | ||
+ | moviesref> | ||
+ | { " | ||
+ | moviesref> | ||
+ | { " | ||
+ | moviesref> | ||
+ | bye | ||
</ | </ | ||
- | Re-démarrez le service dnsmasq pour prendre en compte vos modifications : | + | ===Importer les données=== |
- | < | + | Utilisez maintenant la commande |
- | root@debian8: | + | |
- | </ | + | |
- | + | ||
- | Pour qu' | + | |
< | < | ||
- | root@debian8:~# a2enmod vhost_alias | + | [root@centos7 |
- | Enabling module vhost_alias. | + | 2017-09-20T11: |
- | To activate the new configuration, | + | 2017-09-20T11:19: |
- | | + | [root@centos7 |
- | root@debian8:~# | + | 2017-09-20T11: |
- | root@debian8:~# a2enmod rewrite | + | 2017-09-20T11: |
- | Enabling module rewrite. | + | |
- | To activate the new configuration, | + | |
- | | + | |
</ | </ | ||
- | Editez maintenant le fichier **/ | + | <WRAP center round important> |
- | + | **Important** | |
- | <code> | + | </WRAP> |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | < | + | |
- | + | ||
- | ServerName i2tch.loc | + | |
- | ServerAlias | + | |
- | + | ||
- | ServerAdmin webmaster@localhost | + | |
- | VirtualDocumentRoot / | + | |
- | + | ||
- | LogLevel info | + | |
- | + | ||
- | ErrorLog ${APACHE_LOG_DIR}/ | + | |
- | CustomLog ${APACHE_LOG_DIR}/ | + | |
- | + | ||
- | < | + | |
- | Options FollowSymLinks | + | |
- | AllowOverride All | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
- | </code> | + | |
- | Créez le fichier **/ | + | Re-connectez-vous à MongoDB en utilisant le client mongo : |
< | < | ||
- | root@debian8:~# vi / | + | [root@centos7 |
- | root@debian8:~# cat / | + | MongoDB shell version: 3.2.16 |
- | RewriteEngine On | + | connecting to: test |
- | RewriteBase / | + | Server has startup warnings: |
+ | 2017-09-19T11: | ||
+ | 2017-09-19T11: | ||
+ | test>use moviesref | ||
+ | switched to db moviesref | ||
</ | </ | ||
- | Re-démarrez le serveur apache2 : | + | ====Effectuer la jointure du côté client==== |
- | < | + | Le serveur MongoDB ne sait pas effectuer de jointures. Pour cette raison celles-ci doivent être mises en place du côté client. Cela revient essentiellement à appliquer l’algorithme de jointures par boucle imbriquées en stockant des données temporaires dans des structures de données sur le client, et en effectuant des échanges réseaux entre le client et le serveur. |
- | root@debian8: | + | |
- | </ | + | |
- | Creéz maintenant | + | La première étape dans la jointure côté client consiste à chercher l’artiste Clint Eastwood et à le stocker dans l’espace mémoire du client |
< | < | ||
- | root@debian8:~# mkdir / | + | moviesref> |
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
</ | </ | ||
- | Créez la page d'accueil du site par défaut | + | Ensuite il convient |
< | < | ||
- | root@debian8: | + | moviesref> |
- | root@debian8:~# cat / | + | { " |
- | < | + | { " |
- | < | + | { " |
- | < | + | |
- | </ | + | |
- | </ | + | |
</ | </ | ||
- | Créez deux sites **projecta** et **projectb** : | + | =====MapReduce===== |
- | < | + | ====Définition==== |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | < | + | Etant donné une collection de documents on applique un traitement en deux phases: |
- | root@debian8:~# mkdir / | + | |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | Modifiez l' | + | === La première phase appelée map=== |
- | < | + | Une fonction est appliquée à chaque document de la collection et produit une valeur placée dans un **accumulateur**. |
- | root@debian8: | + | |
- | </ | + | |
- | Modifiez le fichier **/ | + | ===La seconde phase appelée reduce=== |
- | < | + | Les valeurs placées dans l’accumulateur sont traitées par une fonction d’agrégation **reduce** ,produisant une valeur finale. |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | # Generated by NetworkManager | + | |
- | nameserver 127.0.0.1 | + | |
- | nameserver 8.8.8.8 | + | |
- | </ | + | |
- | Testez que vous avez accès aux hôtes virtuels | + | Un exemple simple peut être vu en considérant la requête SQL suivante |
- | < | + | select count(*) from Collection |
- | root@debian8: | + | |
- | Accueil du site 1 | + | |
- | root@debian8:~# lynx --dump http:// | + | Dans ce cas : |
- | Accueil du site 2 | + | |
- | root@debian8: | + | * la phase **map** produit une valeur de 1 et la place dans l' |
- | Accueil du site par défaut | + | * la phase **reduce** calcule la somme pour produire un résultat. |
- | root@debian8:~# lynx --dump http:// | + | En allant un peu plus loins, considérez la requête SQL suivante |
- | Accueil du Project A | + | |
- | root@debian8: | + | select count(*) from Collection group by annee |
- | Accueil du Project B | + | |
- | </ | + | Dans ce cas, les valeurs produites par le **map** sont **partionnées** en groupes où chaque groupe représente une année. Le **map** produit donc des paires **groupe, valeur** ou **année, valeur**. |
- | ====LAB #2 - Gestion | + | Revenons maintenant à notre base de données de films. Notre but est de produire un document par réalisateur contenant la liste des films réalisés par ce réalisateur : |
- | ===Sous RHEL / CentOS 7=== | + | * la phase **map** : un groupe doit être créé par réalisateur contenant les films réalisés par ce dernier, |
+ | * la phase **reduce** : la création du document final. | ||
- | Pour qu' | + | Par exemple la phase **map** est la définition d'une variable |
- | + | ||
- | < | + | |
- | ... | + | |
- | LoadModule userdir_module modules/ | + | |
- | ... | + | |
- | </ | + | |
- | + | ||
- | Afin de pouvoir tester les pages perso, ajoutez un nouveau utilisateur dénommé homepage | + | |
< | < | ||
- | [root@centos7 ~]# groupadd homepage && useradd homepage -c homepage -g homepage -d / | + | movies> |
+ | ... | ||
+ | ... }; | ||
+ | movies> | ||
</ | </ | ||
- | Créez | + | <WRAP center round important> |
+ | **Important** - La fonction contient l' | ||
+ | </WRAP> | ||
- | < | + | La phase **reduce** contient une fonction, **reduceRealisateur**, |
- | [root@centos7 ~]# mkdir / | + | |
- | </ | + | |
- | + | ||
- | Modifiez | + | |
< | < | ||
- | [root@centos7 ~]# chown -R homepage: | + | movies> |
+ | ... var res = new Object(); | ||
+ | ... res.director = directorId; | ||
+ | ... res.films = titres; | ||
+ | ... return res; | ||
+ | ... }; | ||
+ | movies> | ||
</ | </ | ||
- | Ouvrez le fichier | + | <WRAP center round important> |
+ | **Important** - La fonction construit la valeur | ||
+ | </ | ||
- | < | + | Pour lancer le traitement, il convient |
- | [root@centos7 ~]# cat / | + | |
- | # | + | |
- | # UserDir: The name of the directory that is appended onto a user's home | + | |
- | # directory if a ~user request is received. | + | |
- | # | + | |
- | # The path to the end user account ' | + | |
- | # accessible to the webserver userid. | + | |
- | # must have permissions of 711, ~userid/ | + | |
- | # of 755, and documents contained therein must be world-readable. | + | |
- | # Otherwise, the client will only receive a "403 Forbidden" | + | |
- | # | + | |
- | < | + | |
- | # | + | |
- | # UserDir is disabled by default since it can confirm the presence | + | |
- | # of a username on the system (depending on home directory | + | |
- | # permissions). | + | |
- | # | + | |
- | UserDir disabled | + | |
- | + | ||
- | # | + | |
- | # To enable requests to /~user/ to serve the user's public_html | + | |
- | # directory, remove the " | + | |
- | # the following line instead: | + | |
- | # | + | |
- | #UserDir public_html | + | |
- | </ | + | |
- | + | ||
- | # | + | |
- | # Control access to UserDir directories. | + | |
- | # for a site where these directories are restricted to read-only. | + | |
- | # | + | |
- | < | + | |
- | AllowOverride FileInfo AuthConfig Limit Indexes | + | |
- | Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec | + | |
- | Require method GET POST OPTIONS | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | Modifiez ce fichier ainsi : | + | |
< | < | ||
- | [root@centos7 ~]# vi / | + | movies> |
- | [root@centos7 ~]# cat /etc/ | + | { |
- | # | + | " |
- | # UserDir: The name of the directory that is appended onto a user's home | + | { |
- | # directory if a ~user request is received. | + | " |
- | # | + | " |
- | # The path to the end user account ' | + | }, |
- | # accessible to the webserver userid. | + | { |
- | # must have permissions of 711, ~userid/ | + | " |
- | # of 755, and documents contained therein must be world-readable. | + | " |
- | # Otherwise, the client will only receive a "403 Forbidden" | + | }, |
- | # | + | { |
- | < | + | " |
- | | + | " |
- | </ | + | " |
- | + | " | |
- | # | + | " |
- | # Control access to UserDir directories. | + | " |
- | # for a site where these directories are restricted to read-only. | + | ] |
- | # | + | } |
- | < | + | }, |
- | | + | { |
- | | + | " |
- | | + | " |
- | </ | + | " |
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | "value" : "Usual suspects" | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | "films" | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | ... | ||
</ | </ | ||
- | Redémarrez | + | <WRAP center round important> |
+ | **Important** - Le premier paramètre est la fonction de **map**, | ||
+ | </ | ||
- | < | + | **MapReduce** peut prendre plusieurs options dont une s' |
- | [root@centos7 ~]# systemctl restart httpd | + | |
- | </ | + | |
- | + | ||
- | Creéz maintenant une page d' | + | |
< | < | ||
- | [root@centos7 ~]# vi / | + | movies> |
- | [root@centos7 ~]# cat / | + | ... {out: {" |
- | < | + | { |
- | < | + | " |
- | < | + | { |
- | < | + | " |
- | < | + | " |
- | </ | + | }, |
- | </ | + | { |
- | </ | + | " |
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
- | Modifiez les permissions sur le répertoire **/ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# chmod 711 / | ||
- | [root@centos7 ~]# chmod 755 / | ||
- | [root@centos7 ~]# chmod 666 / | ||
</ | </ | ||
- | Le site personnel de l' | ||
- | < | + | =====Références===== |
- | [root@centos7 ~]# lynx --dump http:// | + | |
- | La Page de l' | + | |
+ | * https:// | ||
+ | * https:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * https:// | ||
+ | * http:// | ||
+ | * https:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * https:// | ||
+ | * http:// | ||
+ | * https:// | ||
+ | * http:// | ||
- | [root@centos7 ~]# | + | ----- |
- | </ | + | |
- | + | ||
- | ===Sous Debian 8=== | + | |
- | + | ||
- | Pour qu' | + | |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | Enabling module userdir. | + | |
- | To activate the new configuration, | + | |
- | service apache2 restart | + | |
- | root@debian8: | + | |
- | | + | |
- | root@debian8: | + | |
- | </ | + | |
- | + | ||
- | Afin de pouvoir tester les pages perso, ajoutez un nouveau utilisateur dénommé homepage : | + | |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | root@debian8: | + | |
- | </ | + | |
- | + | ||
- | Créez le répertoire / | + | |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | </ | + | |
- | + | ||
- | Modifiez l' | + | |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | </ | + | |
- | + | ||
- | Consultez le fichier **/ | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | root@debian8: | + | |
- | < | + | |
- | UserDir public_html | + | |
- | UserDir disabled root | + | |
- | + | ||
- | < | + | |
- | AllowOverride FileInfo AuthConfig Limit Indexes | + | |
- | Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec | + | |
- | <Limit GET POST OPTIONS> | + | |
- | Require all granted | + | |
- | </ | + | |
- | < | + | |
- | Require all denied | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | + | |
- | </ | + | |
- | + | ||
- | Creéz maintenant une page d' | + | |
- | + | ||
- | < | + | |
- | root@debian8: | + | |
- | root@debian8: | + | |
< | < | ||
- | <head> | + | <div align=" |
- | <title>Page de Test</ | + | Copyright © 2004-2017 I2TCH LIMITED.<br><br> |
- | < | + | </div> |
- | < | + | |
- | </body> | + | |
</ | </ | ||
- | </ | + | ----- |
- | Modifiez les permissions sur le répertoire **/ | ||
- | |||
- | < | ||
- | root@debian8: | ||
- | root@debian8: | ||
- | root@debian8: | ||
- | </ | ||
- | |||
- | Le site personnel de l' | ||
- | |||
- | < | ||
- | root@debian8: | ||
- | La Page de l' | ||
- | |||
- | |||
- | root@debian8: | ||
- | </ | ||
- | |||
- | ----- | ||
- | < | ||
- | <DIV ALIGN=" | ||
- | Copyright © 2004-2018 Hugh Norris. | ||
- | </ | ||
- | </ | ||