Construction myCat Docker (single node)

Mycat is written using JAVA language development, you need to install before using JAVA Runtime Environment (JRE), due MyCAT use some of the features of JDK7, so requirements must be run on more than JDK7 version.

Mycat supports a variety of database access, such as: MySQL, SQLServer, Oracle, MongoDB, etc., it is recommended to use MySQL Cluster to do.

1. Create a configuration folder Mycat

mkdir /usr/local/mycat
mkdir /usr/local/mycat/conf

2. Create a folder docker

mkdir /usr/local/docker/mycat/
cd /usr/local/docker/mycat

3. Download the installation package mycat

wget http://dl.mycat.io/1.6.6.1/Mycat-server-1.6.6.1-release-20181031195535-linux.tar.gz
mv Mycat-server-1.6.6.1-release-20181031195535-linux.tar.gz mycat.tar.gz

4. unzip and copy files

tar -zxvf mycat.tar.gz
cp -r mycat/conf/ /usr/local/mycat

5. Create Dockerfile file

# Based openjdk: 8 create a mirror, 
# if it is based on centos or other, must make sure that the JDK is installed, otherwise you need to have ADD came in Dockerfile file in 
the FROM openjdk: 8 # file will host directory copied into the mirror and ADD command processing URL and automatically extract the tar archive 
# will myCat extract to / usr / local directory, giving / usr / local / myCat 
ADD mycat.tar.gz / usr / local # container data volume, and saved data for persistent work 
# address mapping address myCat expose profile, direct mapping host computer startup folder 
the VOLUME / usr / local / myCat 
the WORKDIR / usr / local / myCat # to set environment variables in the construction process of the mirror 
MYCAT_HOME = ENV / usr / local / myCat # expose myCat the required ports 
EXPOSE 8066 9066 # as a background process started before myCat service 
CMD [ " / usr / local / myCat / bin / myCat









", "console","&"]

6. Construction of the mirror

# Attention finally. 
Docker Build -t myCat-1.6.6.1.

7. Start container

# Container coupons: -v / usr / local / myCat / the conf /: / usr / local / myCat / the conf / 
# before the colon is the path of the machine, after the colon is the directory path in the container 
docker run --name mycat -p 8066 : 8066 -p 9066: 9066 -v / usr / local / mycat / conf /: / usr / local / mycat / conf / -d mycat-1.6.6.1

Note: In order to determine whether the vessel coupons valid settings can be changed in the next directory of the configuration file, enter the container to see if the file changes, if agreed, is set to succeed.

8. enter and exit the container vessel

# Into the container 
Docker Exec Expediting IT 1b652326460e / bin / the bash 

# two kinds of exit 
# first: stops the exit vessel, type exit at the container terminal 
# Second: exit the container is not stopped, the terminal press Ctrl + P + Q container

9. Configure

Edit / usr / local / server.xml under mycat / conf / directory, schema.xml and other configuration files.

 

Guess you like

Origin www.cnblogs.com/myitnews/p/12380074.html