Repository navigation
中文
v2.0.0 把这个实时推荐演示从「只能跟着外部文章部署」变成可以在本仓库里编译、启动并看到推荐结果的版本。包含已合并的 #64 和 #65。推荐打分公式和 Flink 作业的 state 处理没有改。
#64 可维护性升级
- 新增 Apache-2.0
LICENSE,版权归 water8394 (XInZE)(2019–2026)。README.md链到该许可证,并新增README_EN.md与CONTRIBUTING.md。 - 依赖升级(行为保持,只换到仍能编译现有 DataStream 写法的版本):
| 组件 | 原来 | 现在 |
|---|---|---|
| Java | 1.8 | 11(CI 用 Temurin 17 编译) |
| Flink | 1.7.1(Scala 2.11) | 1.18.1 |
| Flink Kafka connector | flink-connector-kafka_2.11 1.7.1 |
flink-connector-kafka 3.2.0-1.18 |
| kafka-clients | 2.2.0 | 3.9.2 |
| HBase | client + server 1.2.12 | shaded client 2.6.7 |
| Spring Boot | 2.0.1 | 2.7.18 |
| spring-kafka | 约 2.1 | 2.9.13 |
| Jedis(Flink 模块) | 3.0.1 | 5.2.0 |
| MySQL 驱动 | connector/java 8.0.15 | connector/j 8.4.0 |
- Kafka 消费从
FlinkKafkaConsumer换成KafkaSource(仍先用已提交位点,否则从最新位点开始)。 - 增加 GitHub Actions:每次 push / pull request 在 Temurin 17 上执行
mvn -B package。 - 新增不依赖外部服务的单元测试:
SimilarityTest(7)、AgeUtilTest(3)、LogToEntityTest(2)。需要连 MySQL / Redis / HBase 的旧测试仍由 Surefire 排除。 docker-compose.yml去掉写死的192.168.56.103和宿主机路径。Kafka 3.9.2(KRaft)、HBase 2.6.7、Redis 7.4、MySQL 8.0(宿主机端口 3308)、Flink 1.18.1。
#65 可部署的快速开始
- 删掉 README 里已被劫持的外部「文章地址」(
xinze.fun),以及描述另一套手工搭镜像流程的简书 / CSDN 链接。中文步骤在README.md第 5 节,英文对照在README_EN.md。 ./scripts/bootstrap.sh一条命令拉起 compose,并等到 MySQL 导入、HBase 建表、Kafka 主题con就绪。其余脚本负责编译后启动六个 Flink 作业、灌测试日志、补齐热度榜、打开网站并自查。- 在 Linux(Docker Engine 29、Compose v2、JDK 17)上验证过:热度榜 Redis
0=11,/recommand?userId=1返回三列商品名。 - 为让上述步骤跑通,做了小的兼容修复,没有改推荐逻辑:ZooKeeper 监听
0.0.0.0、客户端 quorum 使用127.0.0.1;Jedis 5 用 host + port 而不是把localhost当 URI;Spring Boot 2.7 的 Thymeleaf 不再接受th:onclick字符串拼接,按钮改为data-*,仍然调用原来的sendLog。
English
v2.0.0 makes this real-time recommendation demo buildable and runnable from the repository itself. It includes merged pull requests #64 and #65. Scoring formulas and Flink job state handling are unchanged.
#64 Maintenance upgrade
- Added an Apache-2.0
LICENSE. Copyright water8394 (XInZE), 2019–2026.README.mdlinks it, and the repo now hasREADME_EN.mdandCONTRIBUTING.md. - Dependency upgrades (behavior kept; versions stop where the existing DataStream APIs still compile):
| Component | From | To |
|---|---|---|
| Java | 1.8 | 11 (CI compiles on Temurin 17) |
| Flink | 1.7.1 (Scala 2.11) | 1.18.1 |
| Flink Kafka connector | flink-connector-kafka_2.11 1.7.1 |
flink-connector-kafka 3.2.0-1.18 |
| kafka-clients | 2.2.0 | 3.9.2 |
| HBase | client + server 1.2.12 | shaded client 2.6.7 |
| Spring Boot | 2.0.1 | 2.7.18 |
| spring-kafka | ~2.1 | 2.9.13 |
| Jedis (Flink module) | 3.0.1 | 5.2.0 |
| MySQL driver | connector/java 8.0.15 | connector/j 8.4.0 |
- Kafka consumption moved from
FlinkKafkaConsumertoKafkaSource(committed offsets, then latest). - GitHub Actions runs
mvn -B packageon Temurin 17 for every push and pull request. - New unit tests that do not need external services:
SimilarityTest(7),AgeUtilTest(3),LogToEntityTest(2). Older tests that open MySQL, Redis, or HBase stay excluded from Surefire. docker-compose.ymlno longer hard-codes192.168.56.103or host paths. The stack is Kafka 3.9.2 (KRaft), HBase 2.6.7, Redis 7.4, MySQL 8.0 (host port 3308), and Flink 1.18.1.
#65 Verified quick start
- Removed the hijacked external deployment article (
xinze.fun) and the old Jianshu / CSDN setup notes. Chinese steps areREADME.mdsection 5; the English mirror isREADME_EN.md. ./scripts/bootstrap.shstarts Compose in one command and waits until MySQL is imported, HBase tables exist, and Kafka topicconis ready. Other scripts start the six Flink jobs, generate sample logs, fill the hot-list keys, open the site, and check the page.- Verified on Linux (Docker Engine 29, Compose v2, JDK 17): Redis hot-list key
0is product11, and/recommand?userId=1renders all three columns with product names. - Small compatibility fixes so those steps succeed, without changing recommendation logic: ZooKeeper listens on
0.0.0.0and the client quorum is127.0.0.1; Jedis 5 is constructed with host and port instead of treatinglocalhostas a URI; Boot 2.7 Thymeleaf no longer accepts string concatenation inth:onclick, so the buttons usedata-*attributes and still callsendLog.