Auteur/autrice : admin
-
[Postgres] NEWS
There is some new about PostgreSQL world. Some useful tricks and tips about PostgreSQL, like how to get unused index list (but so many more like displaying fun smiley […]
-
Découverte d’une base mongodb
mongo -u <USERNAME> -p <PASSWORD> –eval « var DATABASE_NAME='<DATABASE_NAME>’ » Source_Discovery_V2.js VARIABLE_DATABASE= DATABASE_NAME;print(« n##################################################### MONGODB_SOURCE_WORKLOAD_&_ASSESSMENT_REPORT #####################################################nn »); shardk=rs.isMaster().msg;if(shardk== »isdbgrid »){mdb=db.getSiblingDB(« config »);a=mdb.shards.find({},{_id: 1,host: 1}).toArray();print(« n »); print(« ***************SHARDED MONGO CLUSTER WITH »,a.length, »SHARDS****************** », »n ») space1=’xa0′.repeat(30);print(« SHARD_NAME »,space1, »SHARD_REPLICA_DETAILS »)for(i=0;i<a.length;i++){t1=a[i]._id;t2=a[i].host;val1=a[i]._id.length;val2=40-val1;space2=’xa0′.repeat(val2);print(t1,space2,t2)}print(« n »);b=mdb.databases.find({},{_id: 1,primary: 1,partitioned: 1}).toArray();space99=’xa0′.repeat(27);space3=’xa0′.repeat(36);print(« DATABASE_NAME »,space99, »PRIMARY_SHARD »,space3, »SHARD_ENABLED »)for(i=0;i<b.length;i++){t1=b[i]._id;if(t1==VARIABLE_DATABASE){val3=b[i]._id.length;val5=40-val3;space4=’xa0′.repeat(val5); t2=b[i].primary;val4=b[i].primary.length;val6=49-val4;space5=’xa0′.repeat(val6);t3=b[i].partitioned;print(t1,space4,t2,space5,t3)}}print(« n »);c=mdb.collections.find({},{_id: 1,key: 1,unique: 1}).toArray();space6=’xa0′.repeat(31);space7=’xa0′.repeat(40);print(« NAMESPACE »,space6, »SHARD_KEY »,space7, »IF_UNIQUE »)for(i=0;i<c.length;i++){t1=c[i]._id;if(!t1.match(« config.* ») && !t1.match(« admin.* »)){try{if(t1.match(« »+VARIABLE_DATABASE+ ».* »)){if(!c[i].dropped){t2=c[i].key;t4=JSON.stringify(t2);t3=c[i].unique;val7=t1.length;val8=t4.length;val9=40-val7;val10=49-val8;space8=’xa0′.repeat(val9);space9=’xa0′.repeat(val10);print(t1,space8,t4,space9,t3)}}}catch […]
-
POSTGRES Backup / restore
Petites bases : #backup -C : ajouter le create database. pg_dump -d $DB > $DB.sql#restorepsql < $DB.sql Grosses bases : #backupon exporte la structure : pg_dump -s $DB> $DBstruct.sql […]
-
[Postgres] VACUUM
Comprendre : autovacuum_freeze_max_age Quand le vacuum ne suffit plus pour réinitialiser le XID d’une table, il faut faire un VACUUM FULL de cette table. SELECT c.oid::regclass as table_name,greatest(age(c.relfrozenxid),age(t.relfrozenxid)) as […]
-
[Postgres] User privs
SELECT grantee AS user, CONCAT(table_schema, ‘.’, table_name) AS table, CASE WHEN COUNT(privilege_type) = 7 THEN ‘ALL’ ELSE ARRAY_TO_STRING(ARRAY_AGG(privilege_type), ‘, ‘) END AS […]
-
Installation et configuration de Cassandra
en-HTCC-8.5.2-Dep-InitializingCassandra.pdf en-GMS-8.5.2-Deployment-ConfiguringanExternalCassandra.pdf Qqs prérequis : Faut désactiver le swap Il y des warning lors de démarrage de cassandra : WARN [main] 2021-04-29 16:18:32,338 SigarLibrary.java:174 – Cassandra server running in […]