First, the image is accelerated.
Docker downloads pictures from the official picture address Docker Hub by default. Because the server is abroad, the frequent download speed is very slow. In order to improve the download speed of pictures, we can manually configure the domestic picture accelerator to make the download speed soar.
There are many mirror accelerator options in China, such as Alibaba Cloud and Daoyun.
This article mainly talks about how to configure Alibaba Cloud's mirror accelerator.
2. 1 Log in to Alibaba Cloud for acceleration information.
/
2.2 configuring Docker
2.2. 1 determine the Docker client version.
Before configuration, you need to determine the version of Docker client. The recommended version is 1. 10.0+:
2.2.2 Configure the mirror accelerator.
PS: Take CentOS system as an example. If you are another system, you can refer to the official documentation of Alibaba Cloud Configuration Accelerator.
Use the accelerator by modifying the daemon configuration file /etc/docker/daemon.json:
Execute the following command:
2.3 Verification speed
Take downloading mongodb as an example to see the speed:
After configuring the accelerator, the speed finally soared.
Second, quick installation &; Build Mysql environment
In this section, we will learn how to quickly install and build Mysql environment through Docker.
2. 1 Download Mysql pictures
Take Mysql 5.7 as an example:
After the download is completed, check whether the image is downloaded successfully through docker images:
2.2 Start with the simplest way.
Start with the simple way:
After the execution of the command is completed, you can also confirm whether the container started successfully through the docker ps command. If successful, we need to copy the directory file in the container to the host, including:
After that, let's delete the container that just ran.
PS: mysql is the name we specified when we ran the container. Of course, you can also execute docker ps first and delete it through the container ID.
2.3 officially run Mysql container
Next, officially run the Mysql container:
Everything else remains the same, and two additional mount subcommands have been added:
After executing the command, check whether the container is started:
As you can see, the container runs successfully.
2.4 try to connect through Mysql client.
Connect the newly created mysql through MySQL client to see if the connection can be successful:
Connection successful!
Third, quick installation &; Building Redis environment
In this section, we will learn how to install &; Build a Redis environment.
3. 1 Download Redis image
First, pull the Redis image. Here I choose the lightweight mirror version of redis: alpine:
After the download is completed, confirm whether the image has been downloaded locally through docker images:
3.2 running Redis container
Command description:
After the command runs, check whether the container started successfully:
You can see that the redis container has been successfully started!
3.3 Connect the container you just created.
Execute the following command to connect redis:
Fourth, quick installation &; Build a MongDB environment
In this section, we will learn how to quickly install and build MongoDB environment through Docker.
4. 1 Download MongoDB image
Take mongo 4 version as an example to download pictures here:
After the download is completed, confirm whether the image was downloaded successfully:
4.2 running MongoDB image
After successful download, run the mongoDB image:
After executing the command, check whether the container is started:
4.3 Add an administrator account
Execute the command:
Then, create a root account with the highest privileges:
After the creation is successful, you will see the successfully added users:
4.4 Connect the newly created root account and test it.
After the connection is successful, we can execute related sql:
Show all databases:
Use database:
Enter the command exit to exit the connection!
Verb (abbreviation for verb) Quick installation &; Building an elastic search environment
In this section, we will learn how to quickly install and build an Elasticsearch environment through Docker.
5. 1 Download Elasticsearch pictures
Elasticsearch 6.5.0 is used here to quickly install &; Building an elastic search environment:
After the download is completed, check whether the image is downloaded successfully through docker images:
5.2 Simply run the Elasticsearch picture first.
After the download is successful, just run the Elasticsearch image:
After the execution of the command is completed, you can also confirm whether the container started successfully through the docker ps command.
You can see that the es container runs successfully. Next, enter the container:
Install the analysis-ik Chinese word segmentation plug-in:
PS: es supports the installation of its own es plug-in command from v5.5. 1 If the version you installed is not 6.5.0, you need to modify the version number in the command. Please refer to/medcl/elasticsearch-analysis-ik for details.
After successful installation, exit the container:
Delete the container that just ran:
PS: Of course, it can also be deleted by the ID of the container.
5.3 Copy related documents
5.4 modify es related configuration
Enter the config configuration directory we just specified and modify the jvm.options file:
PS: Because Xiaoha test server only has 2G memory, here I changed it to JVM memory, which takes up 300 mm. If your memory is enough, you don't need to change it.
Modify the elasticsearch.yml file and add the following configuration:
Explain the added configuration, set the node as the master node, and allow cross-domain access for future access using the graphical interface of the head plug-in.
5.5 Run the Elastic Search Container
This time, we added additional related load commands:
5.6 Test whether es can be accessed normally.
Test whether es started successfully:
Ok, the single-node environment of this es is set up!
Welcome friends who have been Java engineers for one to five years to join Java programmer development: 72 1575865.
Provide free Java architecture learning materials in the group (including high availability, high concurrency, high performance and distribution, Jvm performance tuning, Spring source code, MyBatis, Netty, Redis, Kafka, MySQL, Zookeeper, Tomcat, Docker, Dubbo, Nginx and other knowledge points). Make rational use of every minute to learn and improve yourself, and don't use it any more. Fight hard while you are young, and give yourself an explanation in the future!