Outils pour utilisateurs

Outils du site


blog

Notes nginx

PKI, certificat client : http://reload.eez.fr/blog:2016:01:27:nginx_et_ssl_client_certificate

location /nginx_status {
  stub_status on;
  access_log off;
  allow 127.0.0.1;
  deny all;
}
location /download {
  autoindex on;
  charset utf-8;
}

HTTPS

#cat your_domain_name.crt DigiCertCA.crt >> bundle.crt
#cat keys/pkiweb.lan.crt keys/ca.crt > /etc/nginx/ssl/pkiweb.lan.combined.crt
cat keys/pkiweb.lan.crt keys/ca.crt > /etc/nginx/ssl/pkiweb.lan.crt+chain

Reverse Proxy

Voir https://tenzer.dk/nginx-with-dynamic-upstreams/

/etc/nginx/sites-available/plop.acme.fr.conf

server {
        server_tokens off;
        listen 80;
        server_name www.plop.acme.fr plop.acme.fr;
        rewrite ^ https://$server_name$request_uri? permanent;
}
 
server {
        server_tokens off;
        listen 443 ssl;
        server_name www.plop.acme.fr plop.acme.fr;
 
        ssl_certificate /etc/nginx/ssl/plop.acme.fr.crt;
        ssl_certificate_key /etc/nginx/ssl/plop.acme.fr.key;
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
 
        access_log /var/log/nginx/plop.log;
        error_log /var/log/nginx/plop.err;
 
        #client_max_body_size 0;
        #client_body_buffer_size 128k;
 
        location / {
                include /etc/nginx/proxy_params;
                proxy_pass http://192.168.15.149:8000;
                #client_max_body_size 0;
                #proxy_request_buffering off;
                #proxy_connect_timeout  36000s;
                #proxy_read_timeout  36000s;
                #proxy_send_timeout  36000s;
 
        }
 
}

Pb

client intended to send too large body
client_max_body_size 20M;
service nginx reload

Autres

Nginx letsencrypt

letsencrypt-auto certonly --standalone --email nospam@acme.fr -d acme.fr -d mail.acme.fr

letsencrypt --config-dir=~/etc/letsencrypt/ --logs-dir=~/log/ --work-dir=~/ssl/ certonly --standalone --email nospam@acme.fr -d acme.fr -d mail.acme.fr
letsencrypt --config-dir=$HOME/etc/letsencrypt/ --logs-dir=$HOME/log/ --work-dir=$HOME certonly --standalone --email nospam@acme.fr -d acme.fr -d mail.acme.fr


localtion ~ /.well-known { allow all; }

location ~ /\. { deny all; }

localtion / {
    return 301 https://plop.fr$request_uri;
}


listen [::]:443 ssl http2 ipv6only=on; 
listen 443 ssl http2; 


ssl_certificate /etc/letsencrypt/live/plop.fr/fullchain.pem
ssl_certificate_key /etc/letsencrypt/live/plop.fr/pridvkey.pem

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/plop.fr/fullchain.pem;

resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 3s;

ssl_session_cache shared:SSL:10m
ssl_session_timeout 24h;
ssl_session_tockets on;
ssl_session_ticket_key /etc/nginx/ssl/ticket.key

ssl_protocols TLSv1.2;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
ssl_dhparam /etc/nginx/ssl/dhparam4.pem;
https://github.com/appleboy/letsencrypt-with-nginx/blob/master/nginx.conf


openssl rand 48 -out /etc/nginx/ssl/ticket.key
openssl dhparam -out /etc/nginx/ssl/dhparam4.pem 4096

letsencrypt renew

mkdir /var/www/plop.fr/.well-known/acme-challenge
--rsa-key-size 4096 --webroot-path /var/www/plop.fr/ -d 

sudo cerboot --nginx -d belaris.fr -d www.belaris.fr

cp /opt/letsencrypt/examples/cli.ini /usr/local/etc/plop.ini


https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/
https://www.youtube.com/watch?v=tgvuQM0qgCE
2025/03/24 15:06

Notes NFS

Voir :

findmnt --fstab -t nfs

Serveur

Voir :

  • rclone serv

Si SNMP

/etc/snmp/snmpd.conf
skipNFSInHostResources 1

Disable NFS4 delegations

# On the NFS server
echo 0 > /proc/sys/fs/leases-enable
sysctl -w fs.leases-enable=0

Client NFS

Mapper un utilisateur - monter le FS pour un utilisateur précis

all_squash,anonuid=1010,anongid=1010

l'option no_root_squash spécifie que le root de la machine sur laquelle le répertoire est monté a les droits de root sur le répertoire). L'option root_squash est l'option par défaut

NFS3

Dans les logs Oracle

WARNING:NFS file system /import/oracle/plop mounted with incorrect options(rw,sync,vers=3,rsize=32768,wsize=32768,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,hard,noac,proto=tcp,timeo=600,retrans=2,sec=sys,addr=sicile)
WARNING:Expected NFS mount options for ADR directory: rsize>=4096,wsize>=4096,hard
WARNING:Expected NFS mount options for ADR directory: The 'noac' option should not be set
WARNING: The directory specified for the diagnostic_dest location has
WARNING: incorrect mount options. [/app/oracle/oradata/plop/dump]
NFSv3

hard,bg,intr,vers=3,proto=tcp, rsize=32768, wsize=32768,…

rsize/wsize. Determines the NFS request size for reads/writes. The values of these parameters should match the values for nfs.tcp.xfersize on the NetApp system. A value of 32,768 (32kB) has been shown to maximize database performance in the environment of NetApp and Solaris. In all circumstances, the NFS read/write size should be the same as or greater than the Oracle block size. For example, specifying a DB_FILE_MULTIBLOCK_READ_COUNT of 4 multiplied by a database block size of 8kB results in a read buffer size (rsize) of 32kB.


NetApp recommended mount options for Oracle single-instance database on Solaris:
rw,bg,vers=3,proto=tcp,hard,intr,rsize=32768,wsize=32768,forcedirectio

NetApp recommended mount options for Oracle9i RAC on Solaris:
rw,bg,vers=3,proto=tcp,hard,intr,rsize=32768,wsize=32768,forcedirectio,noac

nas1:/shared_config /u01/shared_config  nfs  rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0
nas1:/shared_grid   /u01/app/11.2.0/grid  nfs  rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0
nas1:/shared_home   /u01/app/oracle/product/11.2.0/db_1  nfs  rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0
nas1:/shared_data   /u01/oradata  nfs  rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0

NFS4

el01sn01:/export/common/patches /u01/common/patches nfs4 rw,bg,hard,nointr,rsize=131072,wsize=131072,proto=tcp

NFS performance can come close to FC

Requires

Network topology be clean

no routers, fast switches

Mount options correct : Rsize / wsize at maximum

  • Avoid actimeo=0 and noac
  • TCP configuration :MTU 9000 (tricky)

Exemple AWS EFS (NFS)

yum install -y nfs-utils
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 MOUNT_TARGET_IP:/ efs

The Amazon EFS client uses the following mount options that are optimized for Amazon EFS:

  • _netdev
  • nfsvers=4.1 – used when mounting on EC2 Linux instances
  • rsize=1048576
  • wsize=1048576
  • hard
  • timeo=600
  • retrans=2
  • noresvport
#rpm -ql nfs-utils
rpm -q --filesbypkg nfs-utils |grep bin
nfs-utils                 /sbin/mount.nfs
nfs-utils                 /sbin/mount.nfs4
nfs-utils                 /sbin/nfs_cache_getent
nfs-utils                 /sbin/rpc.statd
nfs-utils                 /sbin/umount.nfs
nfs-utils                 /sbin/umount.nfs4
nfs-utils                 /usr/sbin/exportfs
nfs-utils                 /usr/sbin/mountstats
nfs-utils                 /usr/sbin/nfsidmap
nfs-utils                 /usr/sbin/nfsiostat
nfs-utils                 /usr/sbin/nfsstat
nfs-utils                 /usr/sbin/rpc.gssd
nfs-utils                 /usr/sbin/rpc.idmapd
nfs-utils                 /usr/sbin/rpc.mountd
nfs-utils                 /usr/sbin/rpc.nfsd
nfs-utils                 /usr/sbin/rpc.svcgssd
nfs-utils                 /usr/sbin/rpcdebug
nfs-utils                 /usr/sbin/showmount
nfs-utils                 /usr/sbin/sm-notify
nfs-utils                 /usr/sbin/start-statd

Selinux

#mount -t nfs -o vers=3,context="system_u:object_r:container_file_t:s0" <server>:/shared_folder /opt/ufm/files
mount -t nfs4        -o context="system_u:object_r:container_file_t:s0" <server>:/shared_folder /opt/ufm/files

Diag

Diag

tshark -Y 'tcp.port == 2049' -r tcpdump.pcap > tcpdump.txt

Pb

Pb avec la commande ''df''

A la place il est possible d'utiliser la commande df -l

sudo umount -a -t nfs -l
sudo umount -a -t nfs4 -l
sudo umount -a -t autofs -l
Err access denied by server while mounting
# mount -t nfs 127.0.0.1:/exports/plop1 /mnt/nfs
mount.nfs: access denied by server while mounting 127.0.0.1:/exports/plop1

# chmod 1777 /exports/plop1
# chmod 1777 /exports
# mount -t nfs 127.0.0.1:/exports/plop1 /mnt/nfs
Err Read-only file system
/etc/exports
#specific IP addresses to appear first, IP ranges after.

#/exports/plop1 192.168.56.0/24(ro,sync,no_subtree_check)
#/exports/plop1 192.168.56.101(rw,sync,no_subtree_check)

/exports/plop1 192.168.56.101(rw,sync,no_subtree_check)
/exports/plop1 192.168.56.0/24(ro,sync,no_subtree_check)
Pb tail latency
Problem

A user mounts the same network file system on two ECS servers (ESC-A and ESC-B). The user writes data in append mode on ECS-A, and monitors file content changes with the tail -f command on ECS-B.

After data is written on ECS-A, the file content changes on ECS-B may experience latency of up to 30 seconds.

However, if a file is directly opened (such as using vi) on ECS-B under the same conditions, the updated content is visible immediately.

Analysis

This is related to the mount option and the tail -f implementation.

The user uses the following mount command : mount -t nfs4 /mnt/

For file systems mounted on ECS-B using the NFS protocol, the kernel maintains a copy of metadata cache for the file and directory attributes. The cached file and directory attributes (including permission, size, and time stamp) are used to reduce the NFSPROC_GETATTR RPC requests.

The tail -f command uses sleep+fstat to monitor changes to the file attributes (primarily the file size), read files, and then output the results. However, file content output by using the tail -f command is dependent on the fstat result. Due to the metadata cache, the fstat command may not be monitoring real-time file attributes. Therefore, even if the file has been updated on the NFS server, the tail -f command cannot detect in real time whether the file has been changed or not, resulting in the latency.

Solution

Use the noac option of the mount command to disable the caching of file and directory attributes. The command is as follows:

mount -t nfs4 -o noac /mnt/

Autres

Cluster multi DC (NFS4 RH8)

rw, sync, noac, actime=0, _netdev

Option exports : rw, sync

2025/03/24 15:06

Utilisation de la commande date

Source : http://www.jacksay.com/tutoriaux/bash-shell/bashshell-utilisation-commande-date.html

Pense-bête pour l'utilisation de la commande date en bash / shell.

Petit pense-bête pour les manipulations de date en Bash/shell.

Bases

Il vaut mieux utiliser la notation YYYY-MM-DD à la place de MM/DD/YY qui est équivoque.

Retourne la date du jour avec les règles de localisation de la machine, par exemple pour une bécane Franco-française :

date

retourne mardi 17 novembre 2009, 06:55:32 (UTC+0100)

date
#
# Si la date et/ou l’heure sont fausses, faire : 
# (MM = mois, DD = jour, hh =heures, mm = minutes, YY = année, ss = secondes : toutes les valeurs sont sur 2 chiffres)
date MMDDhhmmYY.ss
hwclock --systohc

Epoch Timestamp - Temps UNIX - Heure UNIX - POSIX timestamp

Voir

Timestamp Epoch maintenant

date +%s

Convertir un timestamp Epoch dans un format lisible

date -d @1447070995

Le timestamp d'une date précise :

date -d "2011-08-31 23:39:36" +%s

Changer manuellement l'heure du système

Heure locale

date -s "2015-06-06 12:12"

Heure UTC universelle

date -u -s "2015-06-06 10:12"

Et set the Hardware Clock to the current System Time

#hwclock --systohc
hwclock -w

Heure d'un autre fuseau horaire

# Sous Debian, le fichier suivant doit exister :
#ls /usr/share/zoneinfo/Africa/Djibouti
 
env TZ=Africa/Djibouti date
env TZ=':Africa/Djibouti' date

l'option -d

Ensuite y'a la paramètre -d assez “marrant” qui permet ce genre de chose

  date -d 'now'
  # retourne mardi 17 novembre 2009, 06:57:53 (UTC+0100)
  
  date -d 'yesterday'
  # retourne lundi 16 novembre 2009, 06:58:32 (UTC+0100)
  
  date -d "tomorrow"
  # retourne mercredi 18 novembre 2009, 06:58:55 (UTC+0100)
  
  date -d "days"
  # retourne mardi 18 novembre 2009, 06:59:15 (UTC+0100)
  
  date -d "week"
  # retourne mardi 24 novembre 2009, 06:59:30 (UTC+0100)
  
  date -d "month"
  # retourne jeudi 17 décembre 2009, 06:59:59 (UTC+0100)
  
  date -d "year"
  # retourn mercredi 17 novembre 2010, 07:03:08 (UTC+0100)
  

Ensuite on peut utiliser des précisions pour le nombre de jour/semaine/mois/année

  
  date -d "3 days"
  # retourne date 'now' + 3 jours
  
  date -d "2 week"
  # Retourne la date dans 2 semaines
  

Bon etc, ça marche pour jour, semaine, mois année, ensuite on peut ajouter le mot ago pour afficher la date passé.

  
  date -d "1 month ago"
  # retourne la date il y a un mois

Pareil, ça marche pour les jours, semaines, mois et années

Ajouter un nombre de jours à une date précise

  date -d "2024-01-16 34 days ago"
  # Wed Dec 13 00:00:00 CET 2023

Redémarrer un serveur à une date précise

shutdown -r -f $(( ($(date -d "2024-01-13" "+%s") - $(date -d "now" "+%s"))/60 ))

Mettre en forme la date

Format ISO prédéfini

$ date --iso-8601=second
2020-03-05T14:49:58+02:00

Enfin (je vais terminer la dessus), on peut mettre en forme la date un peu à la manière de date() en php

  date "+%Y-%m-%d"
  # retourn ANNEE-MOIS-JOUR

Notez que la chaine de caractère (pattern de format) doit être rédigé de façon assez précise, elle commence par un '+' et les caractères de substitutions sont toujours précédés d'un '%'.

Pour obtenir par exemple en timestamp au format mysql ça donne

  date "+%Y-%m-%d %H:%M:%S"

Voici un petit tour rapide des patterns supportés (les principaux)

Année
  • %Y : Année sur 4 chiffres
  • %C : Le siècle (en gros les 2 premiers chiffres de l'année, si elle a 4 chiffres…)
Mois
  • %b : Nom du mois sur 3 lettres
  • %B : Nom du mois
  • %m : Numéro du mois sur 2 chiffres
Semaine (numéro)
  • %V : Numéro de la semaine
Jours
  • %a : Nom du jour de la semaine sur 3 lettres
  • %A : Nom du jour de la semaine
  • %d : Numéro du jour dans le mois sur 2 chiffres
  • %j : Numéro du jour dans l' année
Heures
  • %H : Heures sur 24 heures
  • %I : Heures sur 12 heures
Minutes
  • %M : Minutes sur 2 chiffres
Secondes
  • %S : Secondes sur 2 chiffres
Raccourcis
  • %F : YYYY-MM-DD
  • %T : HH-MM-SS

Voilà pour les principaux <lang en>patterns</lang>

Sachez enfin qu'un cumule de -d “durée” et de “+%PATTERN” est possible et cela s'avère parfois assez pratique :

  date -d "2 week" "+%F %T"
  # Retourne un timestamp MySQL du jour qu'il sera dans 2 semaines

Pour plus de détails : man date

Exemple numéro de la semaine

Numéro de la semaine courante

date "+%V"

Numéro de la semaine à une date précise

LANG=C date --date="2016-08-16" +"%V"
bash calculate time elapsed between two date timestamps

Source : https://gist.github.com/tuxfight3r/1c11479813bc5ec48fd2e5e648c43384

#!/bin/bash
date1="2023-02-08 10:50:33"
date2="2023-02-08 14:10:33"
date1_seconds=$(date -d "$date1" +"%s")
date2_seconds=$(date -d "$date2" +"%s")
duration=$(( $date2_seconds - $date1_seconds ))
echo "Time Elapsed: $(($duration/3600)) hours $(($duration %3600 / 60)) minutes and $(($duration % 60)) seconds."

Autres

date --rfc-2822
Tue, 15 Sep 2015 14:48:21 +0200

date --rfc-3339=date
2023-03-31

env TZ=Europe/Paris date --rfc-3339=second -d '2023-08-23 21:50'
2023-08-23 21:50:00+02:00
date --rfc-email
Python
#! /usr/bin/env python3
 
import os
import subprocess
 
my_env = {**os.environ, 'TZ': 'Europe/Paris'}
with open(filename, mode="w") as f:
    subprocess.run(["date"], shell=False, check=True, stdout=f, env=my_env)
2025/03/24 15:06

Notes MySQL / MariaDB

Liens :

Réplication :

Voir le client mycli en ligne de commande avec autocomplétion et coloration syntaxique http://blog.adminrezo.fr/2016/01/mycli-pgcli-mysql-postregsql-clients/

Voir aussi TokuDB :

DSN : mysql:host=localhost;dbname=strata

Administration

Connexion à une base

mysql -h localhost -P 3306 -u myuser -pP@ssw0rd -D mydb
 
# Par socket Unix
mysql -u root -S /opt/mysql/5.0.45/socket/mysql-5045.sock -p
 
# En TCP
mysql -u root -h 127.0.0.1 -p
mysql -u root -h $HOSTNAME -p

Droit sur un DB, table

-- CREATE DATABASE `plop-plop` ;
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL PRIVILEGES ON mydb.* TO "myuser"@"localhost" IDENTIFIED BY 'P@ssw0rd';
FLUSH PRIVILEGES;

Droit sur les fichiers (import / export CSV par exemple)

GRANT FILE ON *.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;

Lister les comptes utilisateurs

SELECT USER FROM mysql.user;
SELECT host, USER, password FROM mysql.user;

Sécurité : effacer les comptes root sans mot de passe

mysql -N <<< "DELETE FROM mysql.user WHERE user='root' AND password='' ;"

Lecture seul sur toutes les bases

GRANT SELECT ON *.* TO 'myuserro'@'localhost' IDENTIFIED BY 'P@ssw0rd';
FLUSH PRIVILEGES;

Connaître les requêtes en cours

SHOW PROCESSLIST;

~/.my.cnf

[mysqldump]
user=root
password=P@ssw0rd!
 
[mysql]
user=root
password=P@ssw0rd!
 
[mysqladmin]
user=root
password=P@ssw0rd!
 
[mysqlshow]
user=root
password=P@ssw0rd!

ou bien :

~/.my.cnf

[client]
user=root
password=P@ssw0rd!

C'est valable pour mysql, mysqldump etc..

chmod 600 ~/.my.cnf

bck-mysql.sh

#! /bin/bash
set -o nounset
 
DATE=$(date +%Y%m%d%H%M)
BCK_DIR=~/backup
 
 
DB_LIST=$(mysql --batch -N <<< """show databases;""" |egrep -v "^(information_schema|performance_schema|mysql)$")
RET=$?
 
mysqldump --single-transaction --skip-lock-tables information_schema > ${BCK_DIR}/information_schema-${DATE}.sql.gz
RET=$((RET + $?))
mysqldump --single-transaction --skip-lock-tables performance_schema > ${BCK_DIR}/performance_schema-${DATE}.sql.gz
RET=$((RET + $?))
mysqldump --single-transaction --ignore-table=mysql.event mysql > ${BCK_DIR}/mysql-${DATE}.sql.gz
RET=$((RET + $?))
 
for DB in $DB_LIST
do
  mysqldump --single-transaction $DB |pigz > ${BCK_DIR}/${DB}-${DATE}.sql.gz
  RET=$((RET + $?))
done
 
if [ $(find $BCK_DIR -type f -iname "*.sql.gz" -size -10k |wc -l) -gt 0 ]
then
        echo "Error empty file" >&2
        RET=$((RET + 1))
fi
 
exit $RET
Création ou recréation du dossier /var/lib/mysql

Par exemple après un export

mysqlcheck --all-databases -u root -pP@ssw0rd |pigz > all-dbs.sql.gz
chown mysql: /var/lib/mysql
chmod 700 /var/lib/mysql
 
# mysqld --initialize
mysql_install_db
 
mysql_secure_installation

Config my.cnf

Voir mysqltuner.pl

Sur RedHat par défaut le fichier my.cnf ne possède pas de configuration. Il faut partir d'un exemple

/etc/my.cnf{,.orig}
cp -p /usr/share/mariadb/my-medium.cnf /etc/my.cnf

/etc/mysql/conf.d/lowmem.cnf

[mysqld]
performance_schema = off
key_buffer_size = 16K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer_size = 64K
net_buffer_length = 2K
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
innodb_buffer_pool_size = 16M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
 
[mysqldump]
quick
max_allowed_packet = 16M
 
[mysql]
no-auto-rehash
 
[isamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
 
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
 
[mysqlhotcopy]
interactive-timeout
Pb
Error: Table './glpidb/glpi_logs' is marked as crashed and should be repaired

Solution

Vérif

df -hP
df -hPi

Puis. Mais ne marche malheureusement pas pour les tables en innodb.

#mysqlcheck --repair --all-databases
mysqlcheck --auto-repair --check -A
Erreur importation
mysql -h localhost -u myuser -D  mydb -pmypass < /root/plop.sql

Warning: Using a password on the command line interface can be insecure. ERROR 1071 (42000) at line 52: Specified key was too long; max key length is 767 bytes

SET @@global.innodb_large_prefix = 1;
mysql -D  mydb < /root/plop.sql

ERROR 1709 (HY000) at line 53: Index column size too large. The maximum column size is 767 bytes.

CREATE TABLE `SimpleSAMLphp_saml_LogoutStore` (
  `_authSource` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `_nameId` VARCHAR(40) COLLATE utf8mb4_unicode_ci NOT NULL,
  `_sessionIndex` VARCHAR(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `_expire` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `_sessionId` VARCHAR(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  UNIQUE KEY `_authSource` (`_authSource`,`_nameId`,`_sessionIndex`),
  KEY `SimpleSAMLphp_saml_LogoutStore_expire` (`_expire`),
  KEY `SimpleSAMLphp_saml_LogoutStore_nameId` (`_authSource`,`_nameId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Ajout de ROW_FORMAT=Dynamic dans le CREATE TABLE

CREATE TABLE `SimpleSAMLphp_saml_LogoutStore` (
  `_authSource` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `_nameId` VARCHAR(40) COLLATE utf8mb4_unicode_ci NOT NULL,
  `_sessionIndex` VARCHAR(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `_expire` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `_sessionId` VARCHAR(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  UNIQUE KEY `_authSource` (`_authSource`,`_nameId`,`_sessionIndex`),
  KEY `SimpleSAMLphp_saml_LogoutStore_expire` (`_expire`),
  KEY `SimpleSAMLphp_saml_LogoutStore_nameId` (`_authSource`,`_nameId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=Dynamic;
Autres

Turn on the expanded table formatting mode. This is equivalent to the \x command. `psql` expanded mode equivalency for `mysql`

SELECT * FROM mytable \G; 
Optimisation

Optimiser my.cnf

./mysqltuner.pl

Defrag All Tables or All Databases

mysqlcheck -A

Problème

Pb Invalid (old?) table or database name 'lost+found'
[ERROR] Invalid (old?) table or database name 'lost+found'
Solution

/etc/mysql/mariadb.conf.d/50-server.cnf

[mysqld]
ignore-db-dirs  = lost+found
Error in accept: Too many open files

/var/log/mysql/error.log

190215 11:29:50 [ERROR] /usr/sbin/mysqld: Can't open file: './aquaprox/wp_options.frm' (errno: 24)
190215 11:30:16 [ERROR] /usr/sbin/mysqld: Can't open file: './logiindu/backupdb_wplogi_lstat.frm' (errno: 24)
190215 11:30:17 [ERROR] /usr/sbin/mysqld: Can't open file: './logiindu/backupdb_wplogi_lstat.frm' (errno: 24)
190215 11:30:18 [ERROR] /usr/sbin/mysqld: Can't open file: './logiindu/backupdb_wplogi_lstat.frm' (errno: 24)
190215 11:30:30 [ERROR] /usr/sbin/mysqld: Can't open file: './logiindu/backupdb_wplogi_lstat.frm' (errno: 24)
190215 11:30:31 [ERROR] /usr/sbin/mysqld: Can't open file: './logiindu/backupdb_wplogi_lstat.frm' (errno: 24)
190215 11:30:32 [ERROR] /usr/sbin/mysqld: Can't open file: './logiindu/backupdb_wplogi_lstat.frm' (errno: 24)
190215 11:31:40 [ERROR] Error in accept: Too many open files
Solution
mysql> SHOW VARIABLES LIKE 'open%' ;
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 1024  |
+------------------+-------+
1 row in set (0.00 sec)

/etc/security/limits.d/50-mysql.conf

mysql hard nofile 11264
mysql soft nofile 11264
su - mysql -s /bin/bash
 
ulimit -Hn
ulimit -Sn
session required pam_limits.so

/etc/mysql/my.cnf

[mysqld]
open_files_limit = 10240
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki