# Seckill **Repository Path**: nocturnemk/Seckill ## Basic Information - **Project Name**: Seckill - **Description**: it老哥,秒杀项目 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-12-19 - **Last Updated**: 2022-12-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Seckill # 项目要启动的一些中间件 1. 启动redis-server.exe(用到Redis缓存时,必须启动) - 在redis目录下,使用命令 redis-server, 启动redis服务 - redis-cli 2. 启动rocketMq(集成mq时必须启动) - Mac安装启动mq https://blog.csdn.net/qq_41833935/article/details/125315386 - 记得配置broker连接ip:https://blog.csdn.net/jpf254/article/details/80748021 - 启动mqnamesrv: nohup sh bin/mqnamesrv & - 再启动mqbroker : nohup sh bin/mqbroker -n localhost:9876 -c conf/broker.conf & - 查看启动日志: cat bin/nohup.out - 查看所有topic:bin/mqadmin topicList -n 127.0.0.1:9876 -c defaultCluster - 需要创建名为stock的topic:sh bin/mqadmin updateTopic -n localhost:9876 -b localhost:10911 -t stock - 停止mqbroker : sh bin/mqshutdown broker - 停止mqnamesrv : sh bin/mqshutdown namesrv 3. 启动OpenResty - 在目录 cd /opt/homebrew/cellar/openresty/1.21.4.1_1/nginx 下使用命令 - 启动服务命令:/opt/homebrew/cellar/openresty/1.21.4.1_1/nginx/sbin/nginx -p \`pwd\` -c /opt/homebrew/etc/openresty/nginx.conf - 停止服务命令:/opt/homebrew/cellar/openresty/1.21.4.1_1/nginx/sbin/nginx -p \`pwd\` -s stop - 修改配置后重新加载生效:/opt/homebrew/cellar/openresty/1.21.4.1_1/nginx/sbin/nginx -p \`pwd\` -s reload 5. 启动限流控制台命令(非必须),可以在控制台上配置限流,也可以使用代码控制: - ` Java '-Dserver.port=8888' '-Dsentinel.dashboard.auth.username=sentinel' '-Dsentinel.dashboard.auth.password=admin' '-Dserver.servlet.session.timeout=7200' -jar sentinel-dashboard-1.8.4.jar ` # 运行项目 1. 将端口号设为8080,8081;启动Application.java 2. 打开前端页面,即可看见商品列表,点击商品即可进入商品详情页 - 方式一: 通过idea打开前端页面。listitem.html 商品列表页;getitem.html 商品详情页,提供下单按钮 ![img.png](img.png) - 方式二:直接访问http://localhost/seckillStatic/listitem.html 因为配置了动静分离,静态资源放到了nginx中 3. 点击下单之前,需要先发布活动,将商品库存的数量放到redis中去,所以先请求 http://localhost:8081/goods/publishActivity?activityId=1 接口来发布活动(这里只对苹果手机发布活动) # 说明 - 前端页面中商品列表请求地址为:http://localhost/seckillProxy/goods/list - 前端页面中商品详情请求地址为:http://localhost/seckillProxy/goods/getGoodsDetail?goodsId=1 - 其中:localhost/seckillProxy 是nginx反向代理地址 - /goods/getGoodsDetail 是mapping映射地址