LogLevel alert rewrite:trace6
Category Archives: linux
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
php7.4-dev : Depends: libssl-dev but it is not going to be installed
apt -s install libssl-dev
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.9) but 1.1.1d-1+ubuntu18.04.1+deb.sury.org+2 is to be installed
E: Unable to correct problems, you have held broken packages.
apt-cache policy apt-cache libssl1.1
apt install libssl1.1=1.1.1-1ubuntu2.1~18.04.9
connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80
Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). – connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). – connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out
Err:7 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
echo "Acquire::ForceIPv4 "true";" > /etc/apt/apt.conf.d/99force-ipv4
filebeat separate index for logs
filebeat.inputs:
- ...
fields:
type: "logs1"
- ...
fields:
type: "logs2"
setup.template.name: "myindex-%{[agent.version]}"
setup.template.pattern: "myindex-%{[agent.version]}-*"
output.elasticsearch:
...
index: "myindex-%{[agent.version]}-%{[fields.type]:other}-%{+yyyy.MM.dd}"
wireguard 2 interfaces not workig
vim /etc/wireguard/wg0.conf
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = WG0_SERVER_PRIVATE_KEY
SaveConfig = false
[Peer]
# client1
PublicKey = PUBKEY_FROM_CLIENT_ONE
AllowedIPs = 10.0.0.2/32
vim /etc/wireguard/wg1.conf
[Interface]
Address = 10.0.1.1/24
ListenPort = 51821
PrivateKey = WG1_SERVER_PRIVATE_KEY
SaveConfig = false
[Peer]
# client2
PublicKey = PUBKEY_FROM_CLIENT_TWO
AllowedIPs = 10.0.1.2/32
systemctl start wg-quick@wg0
systemctl start wg-quick@wg1
debian vim insert visual issue
echo "set mouse-=a" >> /root/.vimrc
echo "syntax on" >> /root/.vimrc
telnet udp connection linux
nc -z -v -u 192.168.0.100 100
Connection to 192.118.0.100 100 port [udp/ntp] succeeded!
java for java not registered; not setting
update-alternatives --install /usr/bin/java java /some/path/jdk/bin/java 1
update-alternatives --config java