## RabbitMQ docker
# --------------------
docker run --rm -it -d --hostname my-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management
http://localhost:15672/
credentials guest:guest
https://codeburst.io/get-started-with-rabbitmq-on-docker-4428d7f6e46b
## connect mysql in terminal
docker exec -it bcf53fb14786 bash
mysql --protocol=tcp -u root -p -P 3306
mysql -uroot -p -h 127.0.0.1
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'%' IDENTIFIED BY "admin";
FLUSH PRIVILEGES;
## run docker local container
# -----------------------------------------------------------
# Connect MySQL and Spring with separate docker containers
# -----------------------------------------------------------
# 1) build docker for backend
docker build -t longevity-backend .
# 2) create network to be used
docker network create livelyhealth
# 3) start mysql with network name
docker run --name docker-mysql -v /var/lib/mysql-lively-data:/var/lib/mysql -e MYSQL_ROOT_HOST=% -e MYSQL_ROOT_PASSWORD=oplink456 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d -p:3306:3306 --net livelyhealth --restart always mysql:8 --default-authentication-plugin=mysql_native_password
# 4) start backend with network name
docker run -d -p 8080:8080 -t --net livelyhealth longevity-backend
# -----------------------------------------------------------
# E N D
# -----------------------------------------------------------
# -------- application.properties --------------
spring.datasource.url=jdbc:mysql://docker-mysq
l:3306/longevity
# -----------------------------------------------------------
docker network ls
docker network inspect livelyhealth
# once mysql docker starts, change the user/pwd
mysql -u homestead -p -h 127.0.0.1
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'oplink456';
ALTER USER 'homestead'@'%' IDENTIFIED WITH mysql_native_password BY 'secret';
FLUSH PRIVILEGES;
# use in compass
mongodb://admin:password@localhost:27017/tutorialmern?readPreference=primary&appname=MongoDB%20Compass&ssl=false
# use in code
mongodb://admin:password@localhost:27017/tutorialmern?authSource=admin
## if error with client comes while running
# ==============================
https://stackoverflow.com/questions/55763428/react-native-error-enospc-system-limit-for-number-of-file-watchers-reached
# insert the new value into the system config
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
# check that the new value was applied
cat /proc/sys/fs/inotify/max_user_watches
# config variable name (not runnable)
fs.inotify.max_user_watches=524288
# ==============================
# kill process of any port
kill $(lsof -t -i:3001)
sudo lsof -i -P -n | grep 3306
kill -9 $(lsof -t -i:3306)
# get folder size
du -h --max-depth=1
mongodb+srv://soundarya:@cluster0.ny9zr.mongodb.net/myFirstDatabase?retryWrites=true&w=majority
DATABASE='mongodb+srv://soundarya:droisys@cluster0.ny9zr.mongodb.net/mernstack?retryWrites=true&w=majority';
DATABASE="mongodb://admin:password@localhost:27017/mernstack?authSource=admin"
XuH4tfjE6ZjZXC_xoG48wGaQlU1vcLGWk
# Shortcuts
ln -s /media/soundarya/h_drive/hdrive_data/ ~/hdrive_data
ln -s ~/hdrive_data/MERN/projects/mern_thapa_local/docker_info.md ~/Desktop/desktop_info.md
ln -s ~/hdrive_data/spring ~/spring
ln -s ~/hdrive_data/spring-durgesh ~/spring-learn
ln -s ~/hdrive_data/MERN ~/mern
ln -s ~/hdrive_data/Freedom_financial ~/ff
ln -s ~/hdrive_data/NodeJS ~/NodeJS
#encfs
encfs /mnt/h_drive/hdrive_data/temp/J1A /mnt/h_drive/hdrive_data/temp/J2
fusermount -u /mnt/h_drive/hdrive_data/temp/J2
sudo umount -l /mnt/h_drive/hdrive_data/temp/J2
#compress file
tar cfz bin.tgz bin
#uncompress tar.gz file
tar -xvzf file.tar.gz
#search
grep -rnw '/path/to/somewhere/' -e 'pattern'
#Timestream databases
https://www.g2.com/categories/time-series-databases
#InfluxDB
https://hub.docker.com/_/influxdb
$ docker run -p 8086:8086 \
-v $PWD/data:/var/lib/influxdb2 \
-v $PWD/config:/etc/influxdb2 \
-v $PWD/scripts:/docker-entrypoint-initdb.d \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-e DOCKER_INFLUXDB_INIT_ORG=my-org \
-e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-e V1_DB_NAME=v1-db \
-e V1_RP_NAME=v1-rp \
-e V1_AUTH_USERNAME=v1-user \
-e V1_AUTH_PASSWORD=v1-password \
influxdb:2.0
$ docker run -d -p 8086:8086 \
--restart always \
-v ~/AWSMO/InfluxDB-data/data:/var/lib/influxdb2 \
-v ~/AWSMO/InfluxDB-data/config:/etc/influxdb2 \
-v ~/AWSMO/InfluxDB-data/scripts:/docker-entrypoint-initdb.d \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-e DOCKER_INFLUXDB_INIT_ORG=my-org \
-e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-e V1_DB_NAME=v1-db \
-e V1_RP_NAME=v1-rp \
-e V1_AUTH_USERNAME=v1-user \
-e V1_AUTH_PASSWORD=v1-password \
influxdb:2.1.1
influx config create --config-name influx-config \
--host-url http://localhost:8086 \
--org awsmo \
--token PJ7zd8rw0ai7rOMnTUil_kIz2wlcOzVH9_qD4p_LYxehQS6Uyp6mJ3X9QQUjNAEIigvsMSdyKlvrd5lOLtANRA== \
--active
3.216.123.152
postgres/awsmo@123
db: awsmodb
====
https://www.tutorialspoint.com/spring_boot/spring_boot_database_handling.htm
Restart Postgres server
----------------------------------
Postgres live
3.216.123.152
> cd /usr/pgsql-14/bin
> sudo su postgres
> bash-4.2$ ./pg_ctl restart -D /var/lib/pgsql/14/data
Find number of open connections
----------------------------------
> ps ax | grep post | wc -l
influx -username admin -password 'awsmo@12345'
influx config \
--host-url http://localhost:8086 \
--org my-org \
--token z5XiyReADjf0W915EzfZVGlkGXwhdZjJjOCGVeFjr7iZZ8HTVXK15Z7zA5oySQdn303k6a-uozf2rP67GAo60g== \
--active
influx query 'from(bucket:"my-bucket") |> range(start:-30d)'
https://techviewleo.com/how-to-install-influxdb-on-amazon-linux/
CREATE USER admin WITH PASSWORD 'awsmo@12345' WITH ALL PRIVILEGES
GRANT ALL PRIVILEGES TO admin
curl -G "http://localhost:8086/query?u=admin&p=AWSMO@Password" --data-urlencode "q=SHOW DATABASES"
#QuestDB
https://questdb.io/docs/get-started/docker/
docker run -p 9000:9000 \
-p 9009:9009 \
-p 8812:8812 \
-p 9003:9003 \
questdb/questdb
#open elementary code
io.elementary.code
Influxdb history:
================
Date: 22 Feb 2022
Exported Data: 14000 records, excel size: 3.8 mb
Influxdb Full Backup size: 1.3G