I hereby claim:
- I am dungmanh88 on github.
- I am panther88 (https://keybase.io/panther88) on keybase.
- I have a public key ASA6l5ZmpGdbJSf5lJkaIVs5Wy28nRJ5IMiOT8zkV3VLYwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| vi mongodb_collection_size.js | |
| var collectionNames = db.getCollectionNames(), stats = []; | |
| collectionNames.forEach(function (n) { stats.push(db[n].stats()); }); | |
| stats = stats.sort(function(a, b) { return b['size'] - a['size']; }); | |
| for (var c in stats) { print(stats[c]['ns'] + ":" + stats[c]['count'] + ":" + stats[c]['size'] + "(" + stats[c]['storageSize'] + ")"); } | |
| mongo --port 27017 -u myUserAdmin -p abc123 --authenticationDatabase admin <DB> mongodb_collection_size.js |
| mysql> set profiling=1; | |
| mysql> // command | |
| mysql> show profiles; | |
| mysql> show profile for query 1; | |
| mysql> set @query_id=1; | |
| mysql> SELECT STATE, SUM(DURATION) AS Total_R, ROUND(100 * SUM(DURATION) / (SELECT SUM(DURATION) FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID = @query_id), 2) AS Pct_R, COUNT(*) AS Calls, SUM(DURATION) / COUNT(*) AS "R/Call" FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID = @query_id GROUP BY STATE ORDER BY Total_R DESC; |
| parted /dev/sdb | |
| (parted) mklabel msdos | |
| (parted) mkpart primary ext4 0% 100% | |
| (parted) print | |
| Partition Table: msdos | |
| Number Start End Size Type File system Flags | |
| 1 1049kB 107GB 107GB primary ext4 | |
| (parted) quit |
| select t.table_schema, t.table_name | |
| from information_schema.tables t | |
| left join information_schema.statistics s | |
| on t.table_schema=s.table_schema and t.table_name=s.table_name and s.non_unique=0 | |
| where s.table_name is null and t.table_schema not in ('mysql', 'information_schema','performance_schema'); |
| mysql> grant index, create temporary tables, create view, show view, create routine, alter routine, trigger, delete, insert, select, update, execute on `test`.* to 'user'@'host' identified by 'auth_string'; | |
| mysql> flush privileges; |
| use config | |
| db.settings.update( { _id : "balancer" }, { $set : { activeWindow : { start : "06:00", stop : "23:59" } } }, true ) |
| mysqlbinlog -vv --base64-output=decode-rows mysql-bin.xxxxxx > /tmp/binlog |
| pt-variable-advisor localhost --user=root --ask-pass | |
| Just compare in mysqld section | |
| pt-config-diff /etc/my.cnf.d/server.cnf h=localhost --user=root --ask-pass | |
| pt-config-diff /etc/my.cnf.d/server.cnf /etc/my.cnf.d/server1.cnf | |
| pt-summary | |
| pt-mysql-summary --user=root --ask-pass |