You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
taomi-trade/doc/docker环境-测试环境.md

111 lines
2.7 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

mysql
- docker pull mysql:8.0.19
- mkdir -p /mydata/mysql/{conf,data,log}
- docker run -p 3306:3306 --name mysql -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf/my.cnf:/etc/mysql/conf.d/mysql.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql:8.0.19
- my.cnf 内容
```
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
```
[mysql8修改密码]: https://blog.csdn.net/DongFuPanda/article/details/10965960
---
### redis
- docker pull redis:指定版本
- mkdir -p /mydata/mysql/{data,redis.conf}
- docker run -p 6379:6379 --name redis -v /mydata/redis/redis.conf:/etc/redis/redis.conf -v /mydata/redis/data:/data -d redis redis-server /etc/redis/6379.conf --appendonly yes
---
### nacos
- docker pull nacos:指定版本
- docker run -d \
-e PREFER_HOST_MODE=hostname \
-e MODE=cluster \
-e NACOS_SERVER_PORT=8858 \
-e NACOS_SERVERS="118.178.137.129:8858 118.178.137.129:8868 81.68.204.36:8858" \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_SERVICE_HOST=118.178.137.129 \
-e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD=root \
-e MYSQL_SERVICE_DB_NAME=nacos_config \
-e NACOS_SERVER_IP=118.178.137.129 \
-p 8858:8848 \
--name nacos1 \
nacos/nacos-server
### nginx
- docker pull nginx:指定版本
- mkdir -p /mydata/nginx/{conf,conf.d,html,log}
- docker run -it -d \
--name nginx \
-p 80:80 \
-p 8001:8001 \
-v /mydata/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /home/www/web/test:/usr/share/nginx/html \
nginx
- nginx.conf内容
```
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html; # nginx工作目录是容器的而非宿主机
index index.html index.htm;
}
# 代理转发请求至网关prod-api标识解决跨域问题
location /prod-api/ {
proxy_pass http://118.178.137.12:8090/;
}
}
server {
listen 8001;
server_name localhost;
location / {
root /usr/share/nginx/html; # nginx工作目录是容器的而非宿主机
index index.html index.htm;
}
# axios 配置代理转发 解决浏览器禁止跨域
location /prod-api/ {
proxy_pass http://118.178.137.129:8090/;
}
}
}
```