buy tb500

Archive for February, 2022

create db user and password mariadb – done as production

Sunday, February 27th, 2022

create user ‘db’user’@’10.10.5.5’ identified by ‘ ********** ’ ;

grant all privileges on `dyname`.* to ‘dbuser’@’10.10.5.5’;

Promote postgres slave to master

Wednesday, February 23rd, 2022

su – postgres/usr/pgsql-14/bin/pg_ctl promote -D /var/lib/pgsql/14/data/

How many slave lag behind the master in postgres

Monday, February 21st, 2022
select now()-pg_last_xact_replay_timestamp();

postgres rules

Tuesday, February 8th, 2022

ALTER ROLE grafana_kms_srv WITH LOGIN;
GRANT SELECT ON ALL TABLES IN SCHEMA company_domain TO grafana_kms_srv;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana_kms_srv;
GRANT USAGE ON SCHEMA public TO grafana_fms_srv;
GRANT USAGE ON SCHEMA company_domain TO grafana_fms_srv;

Distribute SSH key in servers

Wednesday, February 2nd, 2022

put the ssh public key of your PC in the following command and run it in any server want to access without password

echo ‘put the public key here’ >> /root/.ssh/authorized_keys

list all the available extensions in postgres

Wednesday, February 2nd, 2022
SELECT * FROM pg_available_extensions;
or 
run this in postgres
\dx