Welcome to my GitHub

Github.com/zq2599/blog…

Content: all original article classification summary and supporting source code, involving Java, Docker, Kubernetes, DevOPS, etc.;

The cause is lazy

I’m a Java programmer. I can’t write code at home without redis, mysql, kafka, these basic services. I usually turn on the computer, start redis, mysql, Kafka, and then turn off the computer after using it. You are right…..)

Not the first time

Maven DS218+ do maven private server (Nexus3) address: “CDH DS218+ do Maven private server (Nexus3)”

Group of CDH DS218 +

At home there is a QUNhui DS218+, for a long time has always been 24 hours on the whole family service, if you can put mysql installed here, it seems that there is no trouble in front;

  1. The picture below is the appearance of DS218+ just bought, with two NAS hard disks, which have been in stable service:

2. The picture below is the memory bar of online shopping. Now there is a total of 2+8=10G memory.3. It is said that the original 2G memory can be replaced by disassembling the machine, so that two 8G memory sticks can be installed.

Train of thought

In fact, the operation is very simple: Qunhui with docker service, using docker to deploy mysql, so, this article is actually the basic operation record of Qunhui Docker, the following places are to pay attention to:

  1. The container port
  2. Container data volume
  3. File permissions
  4. Logging in to a Container

Environmental information

  1. CDH System: DSM 6.2.2-24922 Update 4
  2. Mysql: 5.7.29

The preparatory work

  1. Make sure you have a local directory for your MySQL container, otherwise you won’t be able to retrieve MySQL data if the container fails
  2. In File Station, create a new folder named mysql under the docker directory:

3. Grant permissions to this directory, otherwise the container cannot write data, as shown in the picture below. Right-click and choose Properties from the menu:4. In the picture below, I have released all permissions for the sake of simplicity:5. Operations in the red box below:6. Preparations have been completed and the operation can start.

operation

  1. The CDH management page is displayed
  2. Enter the Docker application, search for the mysql image, and perform the following numerical sequence to download the image:

3. After downloading the image, perform the numerical sequence as shown below to enter the page for starting the container:4. Give the container an appropriate name and click Advanced Settings:5. Select the volume Tab and click Add Folder:Select * from mysql; select * from mysql;/var/lib/mysql.mysql = /var/lib/ mysql.mysql = /var/lib/ mysql.mysql8. Then set the port, as shown below, and change the local port corresponding to 3306 from automatic to 3306:9. Finally, on the Tab page of the environment, add the password setting of MySQL root account, as shown in the following picture, named MYSQL_ROOT_PASSWORD, value 123456, and click the “apply” button in the lower right corner to complete the setting:10. Check the wizard and run the container. Click “Apply” in the lower right corner to create the container:

validation

To verify whether MySQL is available:

  1. Double-click the location in the red box below:

2. On the page that is displayed, double-click the position in the red box below:3. Run a shell command in MySQL namepace:4. A window pops up asking you to type the command, please type /bin/bash:5. Enter the container as shown below:6. Run the mysql -uroot -p123456 command to enter the mysql command mode, as shown in the following figure, the operation is normal:7. Remote connection should also be tried, after all, other machines will be connected by IP address in the future. I have used a Macbook Pro here, installed MySQL Workbench, and configured qunhui’s IP address and port 3306.At this point, QUNhui DS218+ MySQL deployment success, the future database services available at any time, there is no additional cost, code farmers Gospel…

Welcome to pay attention to the public number: programmer Xin Chen

Wechat search “programmer Xin Chen”, I am Xin Chen, looking forward to enjoying the Java world with you…

Github.com/zq2599/blog…