apt install psmisc
diff show only differences side by side
sdiff -bBWs file1 file2
-b Ignore changes in the amount of white space
-W Ignore all white space
-B Ignore changes whose lines are all blank
-s Do not output common lines
scan all scsi_host scan for new drives
for host in `ls /sys/class/scsi_host/`;do
echo “- – -” >/sys/class/scsi_host/${host}/scan;
done
mysql show loaded config file
which mysqld
/usr/sbin/mysqld
/usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
elasticsearch limit memory usage
vim /etc/init.d/elasticsearch
ES_HEAP_SIZE=512m
vim /etc/elasticsearch/elasticsearch.yml
bootstrap.memory_lock: true
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘– INTERVAL 1 DAY’ at line 1
PURGE BINARY LOGS BEFORE DATE_SUB( NOW( ), INTERVAL 1 DAY);
or exact day:
PURGE BINARY LOGS BEFORE '2021-04-11 00:00:00';
urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from
webroot-path should not include full path, so skip .well-known/acme-challenge
apache .htaccess log level debug
LogLevel alert rewrite:trace6
RewriteCond skip acme-challenge
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [xxx]/[xxx] maximum shards openValidation Failed: 1: this action would add [2] total shards, but this cluster currently has [xxx]/[xxx] maximum shards open
curl http://localhost:9200/_cluster/settings?pretty=true
{
"persistent" : {
"cluster" : {
"max_shards_per_node" : "xxxx"
}
},
"transient" : { }
}
curl -XPUT http://localhost:9200/_cluster/settings -H "Content-Type: application/json" -d '{ "persistent": { "cluster.max_shards_per_node": "xxxx" } }'
mysql export users and passwords to another server
mysqldump migrate users to new server
MySQL 5.6 and older
while read line; do mysql -B -N -e "SHOW GRANTS FOR $line"; done < <(mysql -B -N -e "SELECT CONCAT('\'', user,'\'@\'', host, '\'') FROM user WHERE user != 'debian-sys-maint' AND user != 'root' AND user != ''" mysql) | sed 's/$/;/' > mysql_all_users_grants.sql
if MySQL 5.7 and above
while read line; do mysql -B -N -e "SHOW CREATE USER $line"; done < <(mysql -B -N -e "SELECT CONCAT('\'', user,'\'@\'', host, '\'') FROM user WHERE user != 'mysql' AND user != 'root' AND user != ''" mysql) | sed 's/$/;/' > mysql_create_users.sql
while read line; do mysql -B -N -e "SHOW GRANTS FOR $line"; done < <(mysql -B -N -e "SELECT CONCAT('\'', user,'\'@\'', host, '\'') FROM user WHERE user != 'mysql' AND user != 'root' AND user != ''" mysql) | sed 's/$/;/' > mysql_all_users_grants.sql
Excludes some users like root
mysql drop all users except root
while read line; do mysql -B -N -e "drop user $line"; done < <(mysql -B -N -e "SELECT CONCAT('\'', user,'\'@\'', host, '\'') FROM user WHERE user != 'debian-sys-maint' AND user != 'root' AND user != ''" mysql)
mariadb 10.4 ubuntu 20.04
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu focal main'
apt update
apt install mariadb-server
ubuntu install php-newrelic
echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | tee /etc/apt/sources.list.d/newrelic.list
wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -
apt install newrelic-php5
newrelic-install install
wddx php 7.4 pecl
wget https://github.com/php/pecl-text-wddx/archive/master.zip -O wddx.zip
unzip wddx.zip
cd pecl-text-wddx-master
phpize
./configure
make
make install