谷粒商城基础篇0-44集

谷粒商城0-44集总结
gitee地址:
基础篇接口文档地址
?
1.前期搭建 1.1.创建自己的gitee仓库,并且拉下来
在idea里面登录你的gitee的账号
在里面直接进行拉去下来 。
1). 修改我们的pom文件 设置为pom 来进行maven的聚合的管理
2). 然后就是添加5个模块(根据我们sql文件创建不同的的项目)
3). 注意我们的版本依赖(很重要)版本 使用的是2.1.8. 在创建项目的时候选择 来进行微服务的实现,然后我们还要修改的版本 .SR3
如果你的不是这个版本那么你就需要自己去根据网上的版本的对应来进行修改 不然后面一些服务是无法启动的
版本冲突的 。
4). 创建完了所有的模块后,对我们总的pom文件进行修改,实现maven的聚合 。
1.2.虚拟机
首先我们需要准备一个服务器或者是虚拟机,来保证我们的服务不在本地的下面运行,因为系统用来跑项目就可以了,减少了电脑的消耗,我们可以准备使用云服务,可以去阿里云 或者 腾讯云上面去买一个
运行内存尽量大一点就可以了 。
1.3.启动服务
当我们准备好上面这一步以后我们就可以通过云服务来实现我们来启动我们的容器 如 mysql redis …等等
使用我们的来进行连接我们的服务器进行服务的部署 。
当我们拉去下来mysql:5.7 和 redis:6.2.7
我们必须使用容器挂载来进行启动 不然下次启动的时候我们的数据就没有了
1). 启动mysql的命令
首先我们在conf文件下面创建一个f的文件里面来配置我们数据库的字符集
【谷粒商城基础篇0-44集】里面的内容就是设置我们字符集的
f
[client]default_character_set=utf8[mysqld]collation_server = utf8_general_cicharacter_set_server = utf8
下面就是我们的命令(进行容器的挂载)
docker run -d -p 3306:3306 --privileged=true -v /zlm/mysql/log:/var/log/mysql -v /zlm/mysql/data:/var/lib/mysql -v /zlm/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=1234--name mysql mysql:5.7
使用 ps 来查看你的容器是否启动成功了
2). 下面就是启动我们的redis
准备文件redis.conf 也是来配置我们的redis的配置文件 来
里面的内容也是网上找的到进行复制 但是需要修改一些配置(这里就展示一部分)
redis.conf
# Redis configuration file example.## Note that in order to read the configuration file, Redis must be# started with the file path as first argument:## ./redis-server /path/to/redis.conf# Note on units: when memory size is needed, it is possible to specify# it in the usual form of 1k 5GB 4M and so forth:## 1k => 1000 bytes# 1kb => 1024 bytes# 1m => 1000000 bytes# 1mb => 1024*1024 bytes# 1g => 1000000000 bytes# 1gb => 1024*1024*1024 bytes## units are case insensitive so 1GB 1Gb 1gB are all the same.################################## INCLUDES #################################### Include one or more other config files here.This is useful if you# have a standard template that goes to all Redis servers but also need# to customize a few per-server settings.Include files can include# other files, so use this wisely.## Notice option "include" won't be rewritten by command "CONFIG REWRITE"# from admin or Redis Sentinel. Since Redis always uses the last processed# line as value of a configuration directive, you'd better put includes# at the beginning of this file to avoid overwriting config change at runtime.## If instead you are interested in using includes to override configuration# options, it is better to use include as the last line.## include /path/to/local.conf# include /path/to/other.conf################################## MODULES ###################################### Load modules at startup. If the server is not able to load modules# it will abort. It is possible to use multiple loadmodule directives.## loadmodule /path/to/my_module.so# loadmodule /path/to/other_module.so################################## NETWORK ###################################### By default, if no "bind" configuration directive is specified, Redis listens# for connections from all the network interfaces available on the server.# It is possible to listen to just one or multiple selected interfaces using# the "bind" configuration directive, followed by one or more IP addresses.## Examples:## bind 192.168.1.100 10.0.0.1# bind 127.0.0.1 ::1#注意这个一定要注释掉才行