我是靠谱客的博主 失眠歌曲,最近开发中收集的这篇文章主要介绍第160天学习打卡(项目 谷粒商城 2),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Docker 安装redis

docker pull redis


mkdir -p /home/redis/conf
touch /home/redis/conf/redis.conf


docker run -p 6379:6379 --name redis 
-v /home/redis/data:/data 
-v /home/redis/conf/redis.conf:/etc/redis/redis.conf 
-d redis redis-server /etc/redis/redis.conf



docker exec -it redis redis-cli
[root@stor01 ~]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
69692152171a: Pull complete 
a4a46f2fd7e0: Pull complete 
bcdf6fddc3bd: Pull complete 
2902e41faefa: Pull complete 
df3e1d63cdb1: Pull complete 
fa57f005a60d: Pull complete 
Digest: sha256:7e2c6181ad5c425443b56c7c73a9cd6df24a122345847d1ea9bb86a5afc76325
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
[root@stor01 ~]# mkdir -p /home/redis/conf
[root@stor01 ~]# cd home/
-bash: cd: home/: No such file or directory
[root@stor01 ~]# cd /home/
[root@stor01 home]# ls
apache-tomcat-9.0.44-windows-x64  dockerfile               jdk-8u291-linux-x64.tar.gz  my_wordpress                     test
apache-tomcat-9.0.45              Dockerfile               kuangapp                    qinjiang                         tomcatlogs
apache-tomcat-9.0.45.tar.gz       docker-test-volume       kuangshen                   readme.txt                       www
ceshi                             idea                     kuangshen.java              redis
composetest                       jdk-8u291-linux-x64.rpm  mysql                       swagger-demo-0.0.1-SNAPSHOT.jar
[root@stor01 home]# cd redis
[root@stor01 redis]# ls
conf
[root@stor01 redis]# cd conf/
[root@stor01 conf]# ls
[root@stor01 conf]# touch redis.conf
[root@stor01 conf]# docker run -p 6379:6379 --name redis 
> -v /home/redis/data:/data 
> -v /home/redis/conf/redis.conf:/etc/redis/redis.conf 
> -d redis redis-server /etc/redis/redis.conf
3f0d4b93585733149fbac8bf8f56ae6895ced9c37e30415840bbfb9105267546
docker: Error response from daemon: driver failed programming external connectivity on endpoint redis (42c7fe4056672cec5a27373b945e0f1ac073f889ba33d668658839559595ae84): Error starting userland proxy: listen tcp4 0.0.0.0:6379: bind: address already in use.
[root@stor01 conf]# netstat -tanlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1070/sshd           
tcp        0      0 0.0.0.0:36247           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      2015/python         
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      22399/docker-proxy  
tcp        0      0 0.0.0.0:49610           0.0.0.0:*               LISTEN      32588/rpc.statd     
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      21994/redis-server  
tcp        0      0 0.0.0.0:26379           0.0.0.0:*               LISTEN      20898/redis-sentine 
tcp        0      0 127.0.0.1:6381          0.0.0.0:*               LISTEN      9030/redis-server 1 
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      32590/rpcbind       
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3238/nginx: master  
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      32598/rpc.mountd    
tcp        0      0 127.0.0.1:6379          127.0.0.1:43414         ESTABLISHED 21994/redis-server  
tcp        0      0 127.0.0.1:51850         127.0.0.1:8888          TIME_WAIT   -                   
tcp        0      0 127.0.0.1:6381          127.0.0.1:51562         ESTABLISHED 9030/redis-server 1 
tcp        0      0 127.0.0.1:6379          127.0.0.1:57228         ESTABLISHED 21994/redis-server  
tcp        0      0 127.0.0.1:51562         127.0.0.1:6381          ESTABLISHED 20898/redis-sentine 
tcp        0      0 172.16.229.113:22       39.129.5.60:58158       ESTABLISHED 22735/sshd: root@pt 
tcp        0      0 172.16.229.113:22       39.129.5.60:65250       ESTABLISHED 22773/sshd: root@no 
tcp        0      0 172.16.229.113:8888     167.99.203.197:61000    ESTABLISHED 2015/python         
tcp        0      0 172.16.229.113:8888     167.99.106.172:38372    ESTABLISHED 2015/python         
tcp        0      0 127.0.0.1:43414         127.0.0.1:6379          ESTABLISHED 20898/redis-sentine 
tcp        0      0 172.16.229.113:8888     8.133.179.231:49404     ESTABLISHED 2015/python         
tcp        0      0 127.0.0.1:35494         127.0.0.1:6381          ESTABLISHED 20898/redis-sentine 
tcp        0      0 172.16.229.113:33730    100.100.30.26:80        ESTABLISHED 18813/AliYunDun     
tcp        0      0 172.16.229.113:57156    100.100.18.120:443      TIME_WAIT   -                   
tcp        0      0 172.16.229.113:8888     50.18.103.180:57644     ESTABLISHED 2015/python         
tcp        0      0 172.16.229.113:8888     104.152.52.25:50739     ESTABLISHED 2015/python         
tcp        0      0 127.0.0.1:6381          127.0.0.1:35494         ESTABLISHED 9030/redis-server 1 
tcp        0      0 127.0.0.1:45163         127.0.0.1:6381          ESTABLISHED 21994/redis-server  
tcp        0      0 127.0.0.1:57228         127.0.0.1:6379          ESTABLISHED 20898/redis-sentine 
tcp        0      0 127.0.0.1:6381          127.0.0.1:45163         ESTABLISHED 9030/redis-server 1 
tcp6       0      0 :::44252                :::*                    LISTEN      -                   
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
tcp6       0      0 :::26379                :::*                    LISTEN      20898/redis-sentine 
tcp6       0      0 :::111                  :::*                    LISTEN      32590/rpcbind       
tcp6       0      0 :::20048                :::*                    LISTEN      32598/rpc.mountd    
tcp6       0      0 :::40625                :::*                    LISTEN      32588/rpc.statd     
[root@stor01 conf]# kill 21994
[root@stor01 conf]# docker run -p 6379:6379 --name redis -v /home/redis/data:/data -v /home/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
docker: Error response from daemon: Conflict. The container name "/redis" is already in use by container "3f0d4b93585733149fbac8bf8f56ae6895ced9c37e30415840bbfb9105267546". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
[root@stor01 conf]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                     PORTS                               NAMES
3f0d4b935857   redis          "docker-entrypoint.s…"   3 minutes ago   Created                                                        redis
950ef303c587   mysql:8.0.23   "docker-entrypoint.s…"   19 hours ago    Up 18 hours                0.0.0.0:3306->3306/tcp, 33060/tcp   mysql
57599ed1ba88   fa989ba2cbe1   "java -jar /app.jar …"   2 weeks ago     Exited (143) 5 days ago                                        kuangapp_kuangapp_1
686d572dfbfa   efb4fa30f1cf   "docker-entrypoint.s…"   2 weeks ago     Exited (0) 5 days ago                                          kuangapp_redis_1
76d02308eabb   7149d6fde740   "flask run"              2 weeks ago     Exited (137) 2 weeks ago                                       composetest_web_1
e05f32db1027   efb4fa30f1cf   "docker-entrypoint.s…"   2 weeks ago     Exited (0) 2 weeks ago                                         composetest_redis_1
fa0487332774   d1165f221234   "/hello"                 2 weeks ago     Exited (0) 2 weeks ago                                         cool_wu
[root@stor01 conf]# docker rm 3f0d4b935857 
3f0d4b935857
[root@stor01 conf]# docker run -p 6379:6379 --name redis -v /home/redis/data:/data -v /home/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
b457f1db47ccd8d70c0a589ac3c051cca5c7d7ef9a1447851b5f1ef7c24b1ad6
[root@stor01 conf]# docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                               NAMES
b457f1db47cc   redis          "docker-entrypoint.s…"   20 seconds ago   Up 19 seconds   0.0.0.0:6379->6379/tcp              redis
950ef303c587   mysql:8.0.23   "docker-entrypoint.s…"   19 hours ago     Up 18 hours     0.0.0.0:3306->3306/tcp, 33060/tcp   mysql
[root@stor01 conf]# ls
redis,conf  redis.conf
[root@stor01 conf]# rm redis.docker conf 
rm: remove regular empty file ‘redis,conf’? y
[root@stor01 conf]# ls
redis.conf
[root@stor01 conf]# cat redis.conf
cat: redis.conf: Is a directory
[root@stor01 conf]# docker exec -it redis redis-cli
127.0.0.1:6379> set a b
(error) READONLY You can't write against a read only replica.
127.0.0.1:6379> slaveof no one
OK
127.0.0.1:6379> set a b
OK
127.0.0.1:6379> 

遇到的问题:出现下面的错误,表示当前redis服务是只读的,没有写权限,估计该服务是被当作从数据库使用了。

27.0.0.1:6379> set a b
(error) READONLY You can't write against a read only replica

解决办法:

127.0.0.1:6379> slaveof no one
OK
127.0.0.1:6379> set a b
OK

redis持久化操作, 我的修改不了这个文件 所以没有修改 而且 退出后再进人 也能获取值

[root@stor01 conf]# vi redis.conf

appendonly yes

下载redis的可视化客户端 Redis-Desktop-manager(这个的安装直接点下一步就行)

image-20210617173316752

Maven (开发环境统一)

image-20210617174009887

image-20210617175245109

image-20210617175210603

配置阿里云镜像
<mirrors> 
	 <mirror>
          <id>nexus-aliyun</id>
          <mirrorOf>central</mirrorOf>
          <name>Nexus aliyun</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public</url> 
      </mirror>
  </mirrors>

image-20210617185257907

配置jdk1.8编译项目
<profiles>
    <profile>
    <id>jdk-1.8</id>
    <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
    </activation>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>   		 		 				                     <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
    </properties>
    </profile>
</profiles>

image-20210617185432336

1.下载插件 MyBatisX lombok

image-20210617185722836

image-20210617185822943

下载官网地址:Visual Studio Code - Code Editing. Redefined

2.下载viscode

image-20210617190335561

安装完成上面的之后需要在里面安装插件

image-20210617202124690

image-20210617202207582

image-20210617202300903

image-20210617202344577

image-20210617202432662

image-20210617202525517

image-20210617202805462

image-20210617202837494

image-20210617202920293

3.下载Git

下载网址:Git (git-scm.com)

Git里生成公钥的命令:

 git config --global user.name "用户名(可以随便写)"
 git config --global user.email "邮箱"
 ssh-keygen -t rsa -C "邮箱"
 cat ~/.ssh/id_rsa.pub

image-20210617204930898

image-20210617204437337

测试是否成功
ssh -T git@gitee.com

image-20210617205251416

创建项目微服务

在码云上新建仓库

image-20210617210639431

image-20210617210814159

image-20210617211155861

商品服务 仓储服务 订单服务 优惠券服务 用户服务

创建这几个模块的共同点:

1.web、openfeign

2.每个服务, 包名 com.xxxx.gulimail.xxx(product/order/ware/coupon/member)

3.模块名:guilimail-coupon

image-20210617211124305

image-20210617211018439

image-20210617211343413

image-20210617213522255

image-20210617211755321

image-20210617212548121

image-20210617212814461

image-20210617213041367

image-20210617214014354

image-20210617215156036

这个pom.xml修改为以下内容

<?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.doudou.gulimall1</groupId>
    <artifactId>gulimall1-ware</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>gulimall1</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>


</project>


出现的错误

'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' a

解决办法:加上下面一句

<packaging>pom</packaging>

image-20210617214826647

image-20210617220007700

image-20210617220056150

修改.gitignore(这个是修改总的)

image-20210617221229817

target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar



**/mvnw
**/mvnw.cmd

**/.mvn
**/target/

.idea
**/.gitignore

安装Gitee插件

image-20210617221507464

推送文件操作

image-20210617221907305

在码云上进行查看推送的内容:

image-20210617222540787

B站学习网址:全网最强电商教程《谷粒商城》对标阿里P6/P7,40-60万年薪_哔哩哔哩_bilibili

最后

以上就是失眠歌曲为你收集整理的第160天学习打卡(项目 谷粒商城 2)的全部内容,希望文章能够帮你解决第160天学习打卡(项目 谷粒商城 2)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(33)

评论列表共有 0 条评论

立即
投稿
返回
顶部