SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
 LOXODATA
@l_avrot
POSTGRESQL POUR
DÉBUTANTS
JDLL
2018-03-24
Lætitia AVROT
Loxodata
 LOXODATA
@l_avrot
QUI
Lætitia Avrot
Formatrice et consultante PostgreSQL
DBA PostgreSQL, Oracle et SQL Server depuis plus de 10 ans
Quelques gros projets (IGN, DMPH, DMP, Ministères...)
@l_avrot
 LOXODATA
@l_avrot
LOXODATA
Entreprise disposant de 3 piliers d'expertises
PostgreSQL DevOps Cloud
 LOXODATA
@l_avrot
LOXODATA
Une large palette de services
Architecture Conseil Formation
Administration Audit Support
 LOXODATA
@l_avrot
PostgreSQL pour débutants
Le tout début
Apprendre de ses erreurs
Aller plus loin
 LOXODATA
@l_avrot
AU COMMENCEMENT
 LOXODATA
@l_avrot
PostgreS
 LOXODATA
@l_avrot
Le contexte historique
Projet Open Source avant Linux (1986)
Projet vraiment communautaire
Philosophie : la stabilité avant les fonctionnalités
Mascotte : l'éléphant Slonik
 LOXODATA
@l_avrot
Un SGBDR (Système de Gestion de Base de Données Relationnel)
Basé sur l'algèbre relationnelle
Modélisation des données
Conforme à la norme SQL
 LOXODATA
@l_avrot
Le SQL (Standard Query Language)
Langage normé déclaratif
Naturellement lisible en anglais
À écrire par essais et erreurs
https://pgexercises.com
 LOXODATA
@l_avrot
Installation : les étapes
1. Installation du serveur
2. Création du "cluster"
3. Démarrage du serveur
 LOXODATA
@l_avrot
Installation du serveur
Avec des packages (ou installer Windows)
À partir du code source
 LOXODATA
@l_avrot
https://www.postgresql.org/download/
 LOXODATA
@l_avrot
Création du "cluster"
$PGDATA
Souvent déjà fait
initdb
 LOXODATA
@l_avrot
COMMENT S'Y RETROUVER ?
ps -ef | grep postgres
postgres 1374 /bin/postgres -D /data/main
postgres 1375 /bin/postgres -D /data/unicorn
postgres 1376 /bin/postgres -D /data/poney
postgres 1377 /bin/postgres -D /data/pinkiepie
 LOXODATA
@l_avrot
DÉMARRER/ARRÊTER
Debian :
Avec systemd :
Sous Windows :
Arrêt/Démarrage de service
pg_ctlcluster version cluster_name start|stop
systemctl start|stop service_name
 LOXODATA
@l_avrot
UTILISATION
 LOXODATA
@l_avrot
Clients
Graphiques (OmniDB, DBeaver)
Lignes de commandes (psql, vi, pspg)
 LOXODATA
@l_avrot
Connexion
Le serveur
Port d'écoute (5432 par défaut)
Utilisateur (par déaut le même que pour l'OS)
La base de données (par défaut même nom que l'utilisateur)
 LOXODATA
@l_avrot
EXEMPLES DE CONNEXION VIA PSQL
psql
psql -h localhost -U postgres -p 5432 postgres
psql (10.3 (Ubuntu 10.3-1.pgdg16.04+1))
Type "help" for help.
postgres=#
 LOXODATA
@l_avrot
LE PROMPT PSQL
nombase=# (En attente de nouvelle commande)
nombase-# (En attente de suite de commande)
nombase(# (En attente de fermeture de parenthèse)
nombase'# (En attente de fermeture de quote)
 LOXODATA
@l_avrot
QUELQUES TRUCS
conninfo (Donne les informations de connexion)
d nom_objet (Donne les informations sur l'objet)
? (affiche l'aide sur les commandes)
h (affiche l'aide sur le langage SQL)
q (Quitte psql)
 LOXODATA
@l_avrot
AU SECOURS!
FATAL: authentification par mot de passe échouée pour
l'utilisateur « x »
FATAL: aucune entrée dans pg_hba.conf pour
l'hôte « x », utilisateur « y », base de données
« z », SSL actif
postgres=# ljksdfhjkd
postgres-# SELECT random();
ERREUR: erreur de syntaxe sur ou près de « ljksdfhjkd »
LIGNE 1 : ljksdfhjkd
postgres=# exit
postgres-# quit
postgres-# :q
postgres-# fuck!
 LOXODATA
@l_avrot
CONNEXION POSTGRESQL EN PHP
<?php
$connection = pg_connect ("host=localhost dbname=site user=postgres
password=root");
if($connection) {
echo 'connected';
} else {
echo 'there has been an error connecting';
}
?>
 LOXODATA
@l_avrot
CONNEXION POSTGRESQL EN RUBY
require 'pg'
conn = PGconn.open(:dbname => 'test')
 LOXODATA
@l_avrot
CONNEXION POSTGRESQL EN DJANGO
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'db_name',
'USER': 'db_user',
'PASSWORD': 'db_user_password',
'HOST': '',
'PORT': 'db_port_number',
}
}
 LOXODATA
@l_avrot
OBTENIR DE L'AIDE
 LOXODATA
@l_avrot
Documentation
Traduite en français
Téléchargeable
 LOXODATA
@l_avrot
 LOXODATA
@l_avrot
 LOXODATA
@l_avrot
 LOXODATA
@l_avrot
 LOXODATA
@l_avrot
Structure de la documentation
Tuturiel : partie I
Langage SQL : partie II et partie IV.I
Administration : partie III
Drivers de connexion : Partie IV et VIII.H
Programmation : Partie V
Aide sur les applications clientes : Partie VI.II
Aide sur les applications serveur : Partie VI.III
 LOXODATA
@l_avrot
Mailing-lists
Soumission de bug (utilisez le )
pgsql-novice pour les nouveaux
pgsql-hackers
formulaire
 LOXODATA
@l_avrot
Pour les problèmes de sécurité :
security@postgresql.org
 LOXODATA
@l_avrot
IRC
Canal #postgresql #postgresqlfr sur irc.freenode.net
Discussions en direct avec d'autres utilisateurs PostgreSQL
N'ayez pas peur de demander
 LOXODATA
@l_avrot
irc.freenode.net
 LOXODATA
@l_avrot
Autres manières d'obtenir de l'aide
Postgres
Postgres
Forums (as )
Slack
hangout
stackexchange
 LOXODATA
@l_avrot
CONCLUSION
 LOXODATA
@l_avrot
C'est à vous maintenant!
 LOXODATA
@l_avrot
QUESTIONS ?
On recrute
recrutement@loxodata.com

Contenu connexe

Tendances

Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Richard Langlois P. Eng.
 
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...HostedbyConfluent
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderSadayuki Furuhashi
 
Rest & RESTful WebServices
Rest & RESTful WebServicesRest & RESTful WebServices
Rest & RESTful WebServicesPrateek Tandon
 
gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!Alex Borysov
 
Initiation à Express js
Initiation à Express jsInitiation à Express js
Initiation à Express jsAbdoulaye Dieng
 
[243]kaleido 노현걸
[243]kaleido 노현걸[243]kaleido 노현걸
[243]kaleido 노현걸NAVER D2
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQLTomasz Bak
 
Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with PythonLarry Cai
 
Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기KwangSeob Jeong
 
How to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyHow to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyVMware Tanzu
 
(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...
(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...
(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...Amazon Web Services
 
Trino at linkedIn - 2021
Trino at linkedIn - 2021Trino at linkedIn - 2021
Trino at linkedIn - 2021Akshay Rai
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloakGuy Marom
 
Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)Eric SIBER
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Toshiaki Maki
 
Applying OWASP web security testing guide (OWSTG)
Applying OWASP web security testing guide (OWSTG)Applying OWASP web security testing guide (OWSTG)
Applying OWASP web security testing guide (OWSTG)Vandana Verma
 

Tendances (20)

Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5
 
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loader
 
Rest & RESTful WebServices
Rest & RESTful WebServicesRest & RESTful WebServices
Rest & RESTful WebServices
 
gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Initiation à Express js
Initiation à Express jsInitiation à Express js
Initiation à Express js
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
 
[243]kaleido 노현걸
[243]kaleido 노현걸[243]kaleido 노현걸
[243]kaleido 노현걸
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQL
 
Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with Python
 
Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기
 
How to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyHow to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor Netty
 
(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...
(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...
(ENT209) Netflix Cloud Migration, DevOps and Distributed Systems | AWS re:Inv...
 
Trino at linkedIn - 2021
Trino at linkedIn - 2021Trino at linkedIn - 2021
Trino at linkedIn - 2021
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloak
 
Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1
 
Applying OWASP web security testing guide (OWSTG)
Applying OWASP web security testing guide (OWSTG)Applying OWASP web security testing guide (OWSTG)
Applying OWASP web security testing guide (OWSTG)
 

Similaire à PostgreSQL pour débutants

Comment contribuer à PostgreSQL
Comment contribuer à PostgreSQLComment contribuer à PostgreSQL
Comment contribuer à PostgreSQLLætitia Avrot
 
Sauvez le monde avec PITR!
Sauvez le monde avec PITR!Sauvez le monde avec PITR!
Sauvez le monde avec PITR!Lætitia Avrot
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLHervé Leclerc
 
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) univalence
 
PostgreSQL et la réplication
PostgreSQL et la réplicationPostgreSQL et la réplication
PostgreSQL et la réplicationLætitia Avrot
 
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -introNosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -introOlivier Mallassi
 
gRPC, ECHANGES A HAUTE FREQUENCE !
gRPC, ECHANGES A HAUTE FREQUENCE !gRPC, ECHANGES A HAUTE FREQUENCE !
gRPC, ECHANGES A HAUTE FREQUENCE !Carles Sistare
 
gRPC, échange à haute fréquence!
gRPC, échange à haute fréquence!gRPC, échange à haute fréquence!
gRPC, échange à haute fréquence!David Caramelo
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab ElasticsearchDavid Pilato
 
code4lib 2011 : choses vues et entendues par l'ABES
code4lib 2011 : choses vues et entendues par l'ABEScode4lib 2011 : choses vues et entendues par l'ABES
code4lib 2011 : choses vues et entendues par l'ABESABES
 
Présentation Groovy
Présentation GroovyPrésentation Groovy
Présentation Groovyguest6e3bed
 
Présentation Groovy
Présentation GroovyPrésentation Groovy
Présentation GroovyJS Bournival
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - ElasticsearchDavid Pilato
 
Consolidez vos journaux et vos métriques avec Elastic Beats
Consolidez vos journaux et vos métriques avec Elastic BeatsConsolidez vos journaux et vos métriques avec Elastic Beats
Consolidez vos journaux et vos métriques avec Elastic Beatsgcatt
 
DevoxxFR 2019: Consul @Criteo
DevoxxFR 2019: Consul @CriteoDevoxxFR 2019: Consul @Criteo
DevoxxFR 2019: Consul @CriteoPierre Souchay
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applicationsgoldoraf
 
PostgreSQL, plus qu'une base de données, une plateforme aux multiples usages
PostgreSQL, plus qu'une base de données, une plateforme aux multiples usagesPostgreSQL, plus qu'une base de données, une plateforme aux multiples usages
PostgreSQL, plus qu'une base de données, une plateforme aux multiples usagesOpen Source Experience
 

Similaire à PostgreSQL pour débutants (20)

Comment contribuer à PostgreSQL
Comment contribuer à PostgreSQLComment contribuer à PostgreSQL
Comment contribuer à PostgreSQL
 
Sauvez le monde avec PITR!
Sauvez le monde avec PITR!Sauvez le monde avec PITR!
Sauvez le monde avec PITR!
 
Pgbackrest meetup
Pgbackrest meetupPgbackrest meetup
Pgbackrest meetup
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQL
 
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
 
PostgreSQL et la réplication
PostgreSQL et la réplicationPostgreSQL et la réplication
PostgreSQL et la réplication
 
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -introNosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
 
gRPC, ECHANGES A HAUTE FREQUENCE !
gRPC, ECHANGES A HAUTE FREQUENCE !gRPC, ECHANGES A HAUTE FREQUENCE !
gRPC, ECHANGES A HAUTE FREQUENCE !
 
gRPC, échange à haute fréquence!
gRPC, échange à haute fréquence!gRPC, échange à haute fréquence!
gRPC, échange à haute fréquence!
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab Elasticsearch
 
code4lib 2011 : choses vues et entendues par l'ABES
code4lib 2011 : choses vues et entendues par l'ABEScode4lib 2011 : choses vues et entendues par l'ABES
code4lib 2011 : choses vues et entendues par l'ABES
 
Présentation Groovy
Présentation GroovyPrésentation Groovy
Présentation Groovy
 
Présentation Groovy
Présentation GroovyPrésentation Groovy
Présentation Groovy
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - Elasticsearch
 
Consolidez vos journaux et vos métriques avec Elastic Beats
Consolidez vos journaux et vos métriques avec Elastic BeatsConsolidez vos journaux et vos métriques avec Elastic Beats
Consolidez vos journaux et vos métriques avec Elastic Beats
 
sshGate
sshGatesshGate
sshGate
 
Une Introduction à R
Une Introduction à RUne Introduction à R
Une Introduction à R
 
DevoxxFR 2019: Consul @Criteo
DevoxxFR 2019: Consul @CriteoDevoxxFR 2019: Consul @Criteo
DevoxxFR 2019: Consul @Criteo
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applications
 
PostgreSQL, plus qu'une base de données, une plateforme aux multiples usages
PostgreSQL, plus qu'une base de données, une plateforme aux multiples usagesPostgreSQL, plus qu'une base de données, une plateforme aux multiples usages
PostgreSQL, plus qu'une base de données, une plateforme aux multiples usages
 

Dernier

Bidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from TransformersBidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from Transformersbahija babzine
 
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel AttalELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attalcontact Elabe
 
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...France Travail
 
Recurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptxRecurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptxbahija babzine
 
To_understand_transformers_together presentation
To_understand_transformers_together presentationTo_understand_transformers_together presentation
To_understand_transformers_together presentationbahija babzine
 
Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023France Travail
 

Dernier (6)

Bidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from TransformersBidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from Transformers
 
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel AttalELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
 
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
 
Recurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptxRecurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptx
 
To_understand_transformers_together presentation
To_understand_transformers_together presentationTo_understand_transformers_together presentation
To_understand_transformers_together presentation
 
Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023
 

PostgreSQL pour débutants