服务器
阿里云ECS + docker
docker安装MySQL
#docker pull mysql:5.7
#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:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=ROOT \
-d mysql:5.7
进入mysql容器的命令:
[root@iz2ze4be3h3fy5n905om60z ~]# whereis mysql
mysql: /usr/lib64/mysql /usr/share/mysql
配置文件(编码等)
[root@iz2ze4be3h3fy5n905om60z ~]# cd /mydata/
[root@iz2ze4be3h3fy5n905om60z mydata]# ls
mysql
[root@iz2ze4be3h3fy5n905om60z mydata]# cd mysql/
[root@iz2ze4be3h3fy5n905om60z mysql]# ls
conf data log
[root@iz2ze4be3h3fy5n905om60z mysql]# cd conf/
[root@iz2ze4be3h3fy5n905om60z conf]# ls
[root@iz2ze4be3h3fy5n905om60z conf]# vi my.cnf
–
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
skip-name-resolve
–
[root@iz2ze4be3h3fy5n905om60z conf]# docker restart mysql
mysql
[root@iz2ze4be3h3fy5n905om60z conf]# docker exec -it mysql /bin/bash
root@66ca3c67273b:/# cd /etc/mysql/
root@66ca3c67273b:/etc/mysql# ls
my.cnf
root@66ca3c67273b:/etc/mysql# cat 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
skip-name-resolve
docker安装redis
[root@iz2ze4be3h3fy5n905om60z ~]#docker pull redis
[root@iz2ze4be3h3fy5n905om60z ~]# mkdir -p /mydata/redis/conf
[root@iz2ze4be3h3fy5n905om60z ~]# cd /mydata
[root@iz2ze4be3h3fy5n905om60z mydata]# ls
mysql redis
[root@iz2ze4be3h3fy5n905om60z mydata]# cd redis
[root@iz2ze4be3h3fy5n905om60z redis]# ls
conf
[root@iz2ze4be3h3fy5n905om60z redis]# cd conf
[root@iz2ze4be3h3fy5n905om60z conf]# ls
[root@iz2ze4be3h3fy5n905om60z conf]# touch redis.conf
[root@iz2ze4be3h3fy5n905om60z conf]# ls
redis.conf
[root@iz2ze4be3h3fy5n905om60z conf]# docker run -p 6379:6379 --name redis
-v /mydata/redis/data:/data
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf
-d redis redis-server /etc/redis/redis.conf
2deb5f07f65a8c7e3bb6a7b857cf733c94948736152f395aee8fef4f36c1d00f
提示:redis存在内存中,重启后之前的数据就会消失,需要持久化
[root@iz2ze4be3h3fy5n905om60z conf]# docker exec -it redis redis-cli
127.0.0.1:6379>exit
[root@iz2ze4be3h3fy5n905om60z conf]# vi redis.conf
–
redis.conf
appendonly yes
–
[root@iz2ze4be3h3fy5n905om60z conf]# docker restart redis
redis
[root@iz2ze4be3h3fy5n905om60z conf]# docker exec -it redis redis-cli
127.0.0.1:6379> set a1 hello
OK
127.0.0.1:6379> get a1
“hello”
配置git-ssh
SUN@DESKTOP-T7NLKDD MINGW64 ~
$ git config --global user.name "sun"
SUN@DESKTOP-T7NLKDD MINGW64 ~
$ git config --global user.email "xx@qq.com"
SUN@DESKTOP-T7NLKDD MINGW64 ~
$ ssh-keygen -t rsa -C "xx2@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/SUNQIAN/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/SUNQIAN/.ssh/id_rsa.
Your public key has been saved in /c/Users/SUNQIAN/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dW8fjrtGiiNO5i1xPeEYMLKfjsHJ6h0SC4nBCDjuj4E xx@qq.com
The key’s randomart image is:
±–[RSA 3072]----+
|o |
|* . o |
|+o o o . . |
|.o. . o o . |
|+o .o o S = . o. |
|Eo. o= + o + oo…|
| +o…+oo . +. …|
| . oo.=+.o . … |
| … …oo… .o. |
±—[SHA256]-----+
SUN@DESKTOP-T7NLKDD MINGW64 ~
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCkKJhbv0bTxxODKF8qf+DLHtQJ5FT6447tzCV7Ol14vLChSCPumtizcCdPVBKaLxxYAjUAgNpPksvoBR748qPrPjQtYFrP1CsXCU2Vy5VrXQ03J0Nsb1Zcfga0wpF9QUBpMOAxH6CgnJvvvuNSKVTwjsjWnPBwfklNTV1s1fzS9LKoLsiGXg37NcW1/g/x3DrFqr9HEqqbln4cKJ5VSOilhk5jKqnmnbadsrxeqEEkhESqa5f1vfuH2OJEJomEpAIC44ucbmWqy0e3pSCGpFhy6hWHVZU/wiMgxmh07njSmvpw2J7/nZGsFhQDOqZsJGw7wxK6EJ8BIVj5xgB55S4ygXTmfiHuL6vzmbdfh9uwlDUBB9S4rvLgabbGSp+TU4V5QQBkD0UwzyUf9mB4Jqz70wOyzvLQ79BCgL11AsL+t60bhIs15il++TO1Z8et36kO9wqiOqC8XE6iKBKqP5z+Szrf4PwJCi1ymnwR7nu/+8yfzTPZWizba5tjIR+ZW8M=xx@qq.com
SUN@DESKTOP-T7NLKDD MINGW64 ~
$ ssh -T git@gitee.com
The authenticity of host ‘gitee.com (212.64.62.183)’ can’t be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘gitee.com,212.64.62.183’ (ECDSA) to the list of known hosts.
Hi 快乐! You’ve successfully authenticated, but GITEE.COM does not provide shell access.
项目结构创建&提交到gitee
…
结构
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.atguigu.gulimall</groupId>
<artifactId>gulimall</artifactId>
<version>1.0-SNAPSHOT</version>
<name>gulimall</name>
<description>聚合</description>
<packaging>pom</packaging>
<modules>
<module>gulimall-coupon</module>
<module>gulimall-member</module>
<module>gulimall-order</module>
<module>gulimall-product</module>
<module>gulimall-ware</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--spring cloud Hoxton.SR1-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--spring cloud alibaba-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.1.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
各module
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>gulimall</artifactId>
<groupId>com.atguigu.gulimall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.atguigu.gulimall</groupId>
<artifactId>gulimall-order</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>gulimall-order</name>
<description>订单服务</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>