The host shares files with VMware
- Set a shared folder for the VM
2. The shared folder is displayed on the VM
- The first CD/MNT
- Then check to see if there is anything in this folder ls, if not, create a new folder HGFS, mkdir HGFS to create this file
- Run vmhgfs-fuse/MNT/HGFS (requires this folder to have no content)
- Then enter the HGFS folder, you can see our shared files on Windows.
Centos Download files
- Ubuntu uses apt-get
- wegt
Generally speaking, well-known Linux systems fall into two main categories:
- RedHat series: RedHat, Centos, and Fedora
- Debian series: Debian, Ubuntu, etc
RedHat series:
- Common installation package format: RPM package. The command for installing RPM packages is “RPM – parameter”.
- Package management tool Yum
- Support the tar packages
Debian series:
- Deb = deb deb = dpkg-parameter
- Package management tool apt-get
- Support the tar packages
Configure the Java environment for the VM
- Opening a Configuration file
vim /etc/profile
- Add at the end
Export JAVA_HOME=/usr/local/ Java /jdk1.8.0_171 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATHCopy the code
- Enable environment variables
source /etc/profile
- Adding soft Links
Ln -s/usr/local/Java/jdk1.8.0 _171 / bin/Java/usr/bin/Java
- check
Docker creates an image
Docker commit
Docker configuration development environment
-fuse/MNT/HGFS -fuse/MNT/HGFS -fuse/MNT/HGFS -fuse/MNT/HGFS -fuse/MNT/HGFS -fuse/MNT/HGFS
Modify the docker container port mapping and mount directory
Method 1: Delete the original container and build a new container (recommended)
The simplest solution is to delete the original container and create a new one. Don’t forget to add port mapping this time. Advantages and disadvantages: The advantages are simple and fast, and are widely used in test environments. The disadvantage is that if it is a database mirroring, it is more troublesome to build a new one and reconfigure it again.
Method 2: Modify the container configuration file and restart the Docker service
Container configuration file path: The/var/lib/docker/containers / [hash_of_the_container] / hostconfig json hashofthecontainer is docker image hash value, Docker ps or Docker inspect ContainerName Modify the port as required, modify the mount directory as required (permissions and owner owner group must be the same), restart the Docker service, and then start the CONTAINER service.
{
"Binds": [
"/mnt/hgfs/vmware-file/nacos/conf:/home/nacos/conf"],}Copy the code
And config.v2.json to modify MountPoints systemctl restart docker
Advantages and disadvantages: The advantages of this method are no side effects and simple operation. The disadvantage is that the whole Docker service needs to be restarted. If multiple container services are running on the same host, other container services will be affected.
nginx
- Pull the mirror
docker pull nginx
- Create a container
docker run -d -p 80:80 --name mynginx nginx
- Copying configuration Files
nginx.conf
docker cp mynginx:/etc/nginx/nginx.conf /mnt/hgfs/vmware-file/nginx
- Delete the previously created container, recreate the container and add the mount local file
docker run -it -p 80:80 --name mynginx -v /mnt/hgfs/vmware-file/nginx/nginx.conf:/etc/nginx/nginx.conf nginx
- Verify that the local file was successfully mounted The configuration file is mounted successfully
- Test access to nginx
http://192.168.57.130:80
Ps: The nginx directory on Windows has a different structure from the nginx directory on Linux
mysql
- Pull the mirror
docker pull centos/mysql-57-centos7
- Create a container
Docker run -d -p 3306:3306 --name mysql5.7 centos/mysql-57-centos7
- The default user name for logging in to mysql is root, and the password is empty.
Docker exec it mysql5.7 /bin/bash
mysql-u root --p
- After login, change the user name and password
Set password for root@localhost = password(' new password ');
nacos
- Pull the mirror
docker pull nacos/nacos-server
- Create a container
docker run -d -p 8848:8848 --name mynacos nacos/nacos-server
- Copying configuration Files
docker cp mynacos:/home/nacos/conf /mnt/hgfs/vmware-file/nacos
- Test access to nacOS
http://192.168.57.130:8848/nacos
.Note that the connection is followed by /nacosThe default login name and password are both nacos - Viewing configuration Files
- Change the database to mysql, the default of NACOS is embedded database DERy is inconvenient for us to observe the data,Change to mysql5.7 (nacOS official image does not support 8.xx higher version)
- Modify the container mount file (Method 1) Run in single-node mode
docker run -d -p 8848:8848 --name testnacos -v /mnt/hgfs/vmware-file/nacos/conf:/home/nacos/conf --env MODE=standalone nacos/nacos-server
- Modifying the container mount file (Method 2)Modified Binds hostconfig. Json
Modified MountPoints config. V2. Json
seata
- Pull the mirror
docker pull seataio/seata-server
- Create a container
docker run -d -p 8091:8091 --name myseata seataio/seata-server
- Copying configuration Files
docker cp myseata:/mnt/hgfs/vmware-file/seata-server/resources /seata-server/resources
- Reconstruction of the container
docker run -d -p 8091:8091 --name myseata -v /mnt/hgfs/vmware-file/seata-server/resources:/seata-server/resources seataio/seata-server
- Create databases and SQL
https://github.com/seata/seata/tree/develop/script/server
- Modify the configuration to specify that SEATA is registered with NACOS and transactions are saved in the database
Registry {# file, nacos, Eureka, Redis, ZK, Consul, ETCD3, SOFA type = "nacos" nacos {application = "seata-server" ServerAddr = "192.168.57.130:8848" group = "SEATA_GROUP" Namespace = "" cluster = "default" username = "nacos" password = "nacos" } eureka { serviceUrl = "http://localhost:8761/eureka" application = "default" weight = "1" } redis { serverAddr = "localhost:6379" db = 0 password = "" cluster = "default" timeout = 0 } zk { cluster = "default" serverAddr = "127.0.0.1:2181" sessionTimeout = 6000 connectTimeout = 2000 username = "" password = ""} consul {cluster = "Default" serverAddr = "127.0.0.1:8500" aclToken = ""} etcd3 {cluster = "default" serverAddr = "http://localhost:2379" } SOFA {serverAddr = "127.0.0.1:9603" Application = "default" region = "DEFAULT_ZONE" datacenter = "DefaultDataCenter" cluster = "default" group = "SEATA_GROUP" addressWaitTime = "3000" } file { name = "file.conf" } } config { # File, nacos, Apollo, ZK, Consul, ETCD3 Type = "file" nacos {serverAddr = "127.0.0.1:8848" namespace = "" group = "SEATA_GROUP" username = "" password = "" dataId = "seataserver.properties"} consul {serverAddr = "127.0.0.1:8500" aclToken = "" } apollo { appId = "seata-server" ## apolloConfigService will cover apolloMeta apolloMeta = "Http://192.168.1.204:8801" apolloConfigService = "http://192.168.1.204:8080" namespace = "application" ApolloAccesskeySecret = "" cluster = "seata"} zk {serverAddr = "127.0.0.1:2181" sessionTimeout = 6000 connectTimeout = 2000 username = "" password = "" nodePath = "/seata/seata.properties" } etcd3 { serverAddr = "http://localhost:2379" } file { name = "file.conf" } }Copy the code
## transaction log store, only used in seata-server store { ## lock&session store mode: Session {mode = "db"} ## RSA decryption Public key publicKey = "" ## file store property file { ## store location dir dir = "sessionStore" # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions maxBranchSessionSize = 16384 # globe session size , if exceeded throws exceptions maxGlobalSessionSize = 512 # file buffer size , if exceeded allocate new buffer fileWriteBufferCacheSize = 16384 # when recover batch read size sessionReloadReadSize = 100 # async, sync flushDiskMode = async } ## database store property db { ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc. datasource = "druid" ## mysql/oracle/postgresql/h2/oceanbase etc. dbType = "mysql" driverClassName = "com.mysql.jdbc.Driver" ## if using mysql to store the data, How the add rewriteBatchedStatements = true in the JDBC connection url param = "JDBC: mysql: / / 192.168.57.130:3306 / seata? CharacterEncoding =utf8&autoReconnect=true" user = "user" password = "password" minConn = 5 maxConn = 100 globalTable = "global_table" branchTable = "branch_table" lockTable = "lock_table" queryLimit = 100 maxWait = 5000 } ## redis store property redis { ## redis mode: ## single mode property single {host = "127.0.0.1" port = "6379"} ## sentinel mode The property sentinel {masterName = "" # # to the as" 10.28.235.65:26379,10.28. 235.65:26380,10.28. 235.65:26381 "sentinelHosts = "" } password = "" database = "0" minConn = 1 maxConn = 10 maxTotal = 100 queryLimit = 100 } }Copy the code