Skip to content

DevOps Cheat Sheet

March 8, 2021 | 08:00 PM

Linux

Increase max open file

File: /etc/security/limits.conf

* hard nofile 1024000
* soft nofile 1024000
* hard nproc 65535
* soft nproc 65535

<os-user> soft memlock unlimited
<os-user> hard memlock unlimited

Rsync parallel

rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" [email protected]<source>:<source_dir> <dest_dir>

MySQL

CREATE USER 'finley'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'finley'@'localhost';
GRANT SELECT ON *.* TO 'u'@'%' IDENTIFIED BY 'password';

FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
or
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
mysqldump [options] db_name [tbl_name ...]
mysql -u <username> -p <databasename> < <filename.sql>

Redis

Delete key by pattern

redis-cli --raw keys "$PATTERN" | xargs redis-cli del
redis-cli KEYS "prefix:*" | xargs redis-cli DEL