Commands

Linux

Search for packages using amazon-linux-extras

amazon-linux-extras | grep mariadb

Install MYSL using amazon-linux-extras

amazon-linux-extras install -y mariadb10.5

Clear cache in EC2 Machine

echo 3 > /proc/sys/vm/drop_caches

MySQL

Threads connected

SHOW STATUS WHERE variable_name = 'Threads_connected';

Max connections

SHOW VARIABLES LIKE 'max_connections';

Process list

SHOW PROCESSLIST;

Rails

Execute the Rails bash console running in 3000 port

docker exec -it $(docker ps | grep '3000' | awk '{print $1}') bash

Execute the Nginx sh console running in 80 port

docker exec -it $(docker ps | grep '80' | awk '{print $1}') bash

Execute rails console

bundle exec rails c production

Assets precompile

RAILS_ENV=production bundle exec rake assets:precompile

Postgres

DB read access user creation

CREATE ROLE readaccess;
GRANT CONNECT ON DATABASE <dbname> TO readaccess;
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
CREATE USER <read_user> WITH PASSWORD 'abc12345';
GRANT readaccess TO <read_user>;

Last updated

Was this helpful?