NextCloud : Suppression manuelle des anciennes versions de fichier

189 x served & 14 x viewed

En faisant l’inspection de mon disque pour NextCloud j’ai pu voir que l’espace disque utilisé était énorme :

/usr/share/nginx/nextcloud# du -sh data/
322G data/

J’ai donc lancé une suppression manuelle des anciennes version de fichier :

/usr/share/nginx/nextcloud# sudo -u www-data php7.3 /usr/share/nginx/nextcloud/occ versions:cleanup
Delete all versions
Delete versions for users on backend Database
...

A la fin du process :

/usr/share/nginx/nextcloud# du -sh data/
91G	data/

Donc suppression de 231 Go .

Nextcloud : Comment forcer le scan des photos avoir fait des modifications ( Application Maps )

198 x served & 33 x viewed

Voici la commandes que j’utilises pour forcer le scan des photos :

sudo -u www-data php7.3 /usr/share/nginx/nextcloud/occ maps:scan-photos

Le lien vers l’application :

https://github.com/nextcloud/maps

NEXTCLOUD : Error : SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock

348 x served & 132 x viewed

Sur NEXTCLOUD j’ai l’erreur : SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock;

Mes versions :

  • NEXTCLOUD : 20.0.1 ( command : sudo -u www-data php /var/www/html/nextcloud/occ –version )
  • MARIADB : 10.3.25-MariaDB-0+deb10u1 Debian 10
  • PHP : 7.3.19-1~deb10u1
  • OS : Debian 10

Quand j’essaye de voir ou est le problème :

MariaDB [(none)]> SHOW ENGINE INNODB STATUS;
...
| InnoDB |      | 
=====================================
2020-11-17 09:19:30 0x7fa224b77700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 15 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 461 srv_active, 0 srv_shutdown, 600286 srv_idle
srv_master_thread log flush and writes: 600676
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 98430
OS WAIT ARRAY INFO: signal count 85332
RW-shared spins 64094, rounds 1791314, OS waits 59076
RW-excl spins 22498, rounds 84684, OS waits 850
RW-sx spins 1924, rounds 35426, OS waits 904
Spin rounds per wait: 27.95 RW-shared, 3.76 RW-excl, 18.41 RW-sx
------------------------
LATEST DETECTED DEADLOCK
------------------------
2020-11-14 16:45:09 0x7fa23828d700
*** (1) TRANSACTION:
TRANSACTION 506754, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 7 lock struct(s), heap size 1128, 7 row lock(s), undo log entries 3
MySQL thread id 33716, OS thread handle 140334704551680, query id 602553 localhost farias Updating
UPDATE `oc_file_locks` SET `lock` = `lock` - '1' WHERE (`key` IN ('files/f3c7b68359c596992199b90449d7ff8c', 'files/5a2eaa89d932ecbb1dfec1006109244b', 'files/b34c1fc8665aefe70b8e44d4ac09aa67', 'files/994269d0fc31eeda97e0469ed6ab8da3', 'files/d6a2d20758f30740cbecca7cc8b13233', 'files/8853c6e699dd4e7e2655f41918e5a1d2', 'files/3320d1d40cdf4b94707b61cda6ecae0b', 'files/2af4fbefe05ca8c38046394574650bed', 'files/c5f55069bcd203aaa95e4290aabd8c8b', 'files/5aa7bb013dd77e1cdc270e19760a6a23', 'files/d4be38ed80c9b1bf63e3bf45937fb8cd', 'files/ecaafc552486d9c983da23ce46dd72eb', 'files/bbeee26a3ecfeb7ea06dc35abfdff76b', 'files/69f5b0b8e324f92f590b6211eb6c96a1', 'files/5f57699c6ab4f6f04e2c1649ded34919', 'files/c122984832ebf9f0484fd06b33caf6ca', 'files/7c240806d390dc989d67aeb310ce09ac', 'files/d183dc061d795de42af22fbdac8d9ace', 'files/64149897c3515f6526f20690d6cdaa86', 'files/2cd2b02ce9f36f5a067cf8d8e205f34e', 'files/bac5d6b465c
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 39 page no 53 n bits 232 index lock_key_index of table `nextclouddb`.`oc_file_locks` trx id 506754 lock_mode X locks rec but not gap waiting
Record lock, heap no 25 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 30; hex 66696c65732f356132656161383964393332656362623164666563313030; asc files/5a2eaa89d932ecbb1dfec100; (total 38 bytes);
 1: len 8; hex 0000000000004b43; asc       KC;;

*** (2) TRANSACTION:
TRANSACTION 506747, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
16 lock struct(s), heap size 1128, 16 row lock(s), undo log entries 6
MySQL thread id 33717, OS thread handle 140334703630080, query id 602561 localhost farias Update
INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES('files/3320d1d40cdf4b94707b61cda6ecae0b', '1', '1605372309')
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 39 page no 53 n bits 232 index lock_key_index of table `nextclouddb`.`oc_file_locks` trx id 506747 lock mode S
Record lock, heap no 25 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 30; hex 66696c65732f356132656161383964393332656362623164666563313030; asc files/5a2eaa89d932ecbb1dfec100; (total 38 bytes);
 1: len 8; hex 0000000000004b43; asc       KC;;

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 39 page no 39 n bits 352 index lock_key_index of table `nextclouddb`.`oc_file_locks` trx id 506747 lock mode S waiting
Record lock, heap no 111 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 30; hex 66696c65732f333332306431643430636466346239343730376236316364; asc files/3320d1d40cdf4b94707b61cd; (total 38 bytes);
 1: len 8; hex 0000000000004b4b; asc       KK;;

*** WE ROLL BACK TRANSACTION (1)
------------
TRANSACTIONS
------------
Trx id counter 546878
Purge done for trx's n:o < 546878 undo n:o < 0 state: running but idle
History list length 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421809682043144, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 421809682038928, not started
0 lock struct(s), heap size 1128, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
2613 OS file reads, 488009 OS file writes, 304247 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 9, seg size 11, 41 merges
merged operations:
 insert 43, delete mark 724, delete 8
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 2 buffer(s)
Hash table size 34679, node heap has 5 buffer(s)
Hash table size 34679, node heap has 2 buffer(s)
Hash table size 34679, node heap has 2 buffer(s)
Hash table size 34679, node heap has 3 buffer(s)
Hash table size 34679, node heap has 8 buffer(s)
Hash table size 34679, node heap has 7 buffer(s)
Hash table size 34679, node heap has 10 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 536481738
Log flushed up to   536481738
Pages flushed up to 536481738
Last checkpoint at  536481729
0 pending log flushes, 0 pending chkp writes
211673 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 170655744
Dictionary memory allocated 615072
Buffer pool size   8192
Free buffers       4922
Database pages     2746
Old database pages 993
Modified db pages  0
Percent of dirty pages(LRU & free pages): 0.000
Max dirty pages percent: 75.000
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 3994, not young 1406
0.00 youngs/s, 0.00 non-youngs/s
Pages read 2351, created 395, written 247428
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 2746, unzip_LRU len: 1013
I/O sum[42]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=645, Main thread ID=140333945968384, state: sleeping
Number of rows inserted 14499, updated 74567, deleted 5768, read 9673725
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
Number of system rows inserted 0, updated 0, deleted 0, read 18326
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

Je n’arrive pas à trouver le problème.

Misère.

 

NextCloud : Ajouter un certificat SSL sur Apache.

404 x served & 240 x viewed

Ma procédure :

Etape 1 : Ajouter les bons packages :

$ apt-get update && apt-get install certbot python-certbot-apache

Etape 2 : Demande du certificat :

$ certbot --apache -w /var/www/html/nextcloud/ -d my.cyber-neurones.org
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for my.cyber-neurones.org
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/nextcloud-le-ssl.conf
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/nextcloud-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/nextcloud-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://my.cyber-neurones.org

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=my.cyber-neurones.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/my.cyber-neurones.org/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/my.cyber-neurones.org/privkey.pem
   Your cert will expire on 2021-01-31. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le


Etape 3 : Restart de apache :

$ /etc/init.d/apache2 restart
[ ok ] Restarting apache2 (via systemctl): apache2.service

Rien de plus simple …