Showing posts with label Docker. Show all posts
Showing posts with label Docker. Show all posts
Saturday, July 25, 2020
AWS EC2 : Dockerize Java App & Deploy Container
https://youtu.be/ToqoJ8YAkRg
Dockerize app and deploy in EC2 instance
Push the docker image to Docker Hub public repository
Steps:
1. Setting up docker engine
sudo yum update -y
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
2. Dockerize your application
-- Dockerfile
FROM java:8
WORKDIR /
ADD myapp.jar myapp.jar
COPY application.properties application.properties
EXPOSE 5000
CMD java -jar myapp.jar -Dspring.config.location=application.properties
3. Building docker image of application:
docker build -t myapp .
4. Tagging image
docker tag myapp nirajtechi/myapp
5. Overriding port while launching docker container
docker run -p 8080:5000 nirajtechi/myapp
6. Push image to repository (Docker Hub)
docker push nirajtechi/myapp
7. Pull image from repository (Docker Hub)
docker pull nirajtechi/myapp
Monday, July 6, 2020
How can Docker help a MariaDB cluster for Disaster/Recovery
https://blog.dbi-services.com/how-can-docker-help-a-mariadb-cluster-for-disaster-recovery/
This post is a work in progress ; On the above link is the original ideea ;
Mistakes or accidental data deletions can sometimes happen on a productive MariaDB Galera Cluster and this can be disastrous.
There are so many cases I have heard by customers and hereafter are some of the most common:
– dropping one column of a table
– dropping one table
– updating a big table without a where clause
What if it was possible to restore online a subset of data without downtime?
MariaDB preparation
We need some help from Docker ;
Using a delayed node (the helper), we can deploy a container with a delayed replication of 15minutes, but of course you can choose your own lags.
Using a delayed node (the helper), we can deploy a container with a delayed replication of 15minutes, but of course you can choose your own lags.
MariaDB > create user rpl_user@’192.168.56.%' IDENTIFIED BY 'manager';MariaDB > GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%’;MariaDB > show grants for 'rpl_user'@'’192.168.56.%';+-------------------------------------------------------------------------------------+| Grants for rpl_user@% |+-------------------------------------------------------------------------------------+| GRANT REPLICATION SLAVE ON *.* TO 'rpl_user'@'’192.168.56.%' |+-------------------------------------------------------------------------------------+
$ vi /storage/mariadb-slave-15m/mariadb.conf.d/my.cnf[mysqld]server_id=10015binlog_format=ROWlog_bin=binloglog_slave_updates=1relay_log=relay-binexpire_logs_days=7read_only=ON
The most important parameter is “MASTER_DELAY” as it determines the amount of time in seconds the slave should lag behind the master.
CHANGE MASTER TO MASTER_HOST = '192.168.56.203’, \
MASTER_USER = 'rpl_user', MASTER_PASSWORD = 'manager’, \
MASTER_DELAY=900;
START SLAVE
Subscribe to:
Posts (Atom)