Skip to content

Commit

Permalink
docs: 添加部署说明
Browse files Browse the repository at this point in the history
  • Loading branch information
vector4wang committed Aug 11, 2019
1 parent 0aa7db4 commit 52268b3
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
140 changes: 135 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,142 @@

<div align=center><img src="resources/pic/后台数据.png" width="80%" height="100%"></div>

### 5. 部署说明 (待补充)
### 5. 部署说明
![system](resources/pic/system.png)
需要的服务有:Mysql、Redis、Hbase和Kafka,建议使用Docker部署(如果对Docker不熟悉,可以简单的把[Docker专栏](https://blog.csdn.net/qqHJQS/column/info/33078)看一看, 很快就会上手)

#### Mysql
```
docker pull mysql:5.7
docker run --name local-mysql -p 3308:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
```
比较简单,先拉取镜像,然后指定参数启动容器
- `--name local-mysql` 容器名为local-mysql
- `-p 3308:3306` 宿主机与容器的端口映射为3308:3306 即你防伪宿主机的3308就是访问容器的3306端口,需要理解下
- `-e MYSQL_ROOT_PASSWORD=123456` 容器内的变量名`MYSQL_ROOT_PASSWORD`对应的值为123456 即mysql的root密码为123456
- `-d` 后台启动


#### Redis
https://hub.docker.com/_/redis

```bash
$ docker run --name local-redis -p 6379:6379 -d redis
```
直接执行脚本即可

#### Hbase
##### pull镜像

`docker pull harisekhon/hbase`

##### 启动脚本

```bash
docker run -d -h base-server \
-p 2181:2181 \
-p 8080:8080 \
-p 8085:8085 \
-p 9090:9090 \
-p 9000:9000 \
-p 9095:9095 \
-p 16000:16000 \
-p 16010:16010 \
-p 16201:16201 \
-p 16301:16301 \
-p 16020:16020\
--name hbase \
harisekhon/hbase

```

![Hbase用到的端口](http://cdn.wangxc.club/20190716221732.png)

hbase对应的端口(harisekhon/hbase 修改了默认端口:)
```text
# Stargate 8080 / 8085
# Thrift 9090 / 9095
# HMaster 16000 / 16010
# RS 16201 / 16301
EXPOSE 2181 8080 8085 9090 9095 16000 16010 16201 16301
```
注意客户端要使用的端口号是

##### 设置host
```text
127.0.0.1 base-server
```

webui in http://localhost:16010/master-status
[快速实现springboot集成Hbase](https://github.com/vector4wang/spring-boot-quick/tree/master/quick-hbase)
#### Kafka
考虑到更好的区别这些端口,我这里启动了一个虚拟机,在虚拟机中在用dokcer安装Kafka,过程如下

##### download images
```bash
docker pull wurstmeister/zookeeper
docker pull wurstmeister/kafka
docker pull sheepkiller/kafka-manager
```



##### run zookepper
```bash
docker run -d --name zookeeper --publish 2181:2181 \
--volume /etc/localtime:/etc/localtime \
--restart=always \
wurstmeister/zookeeper
```


##### run kafka

```bash
docker run --name kafka \
-p 9092:9092 \
--link zookeeper:zookeeper \
-e KAFKA_ADVERTISED_HOST_NAME=192.168.1.8 \
-e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
-d wurstmeister/kafka
```

##### run kafka manager
```bash
docker run -d \
--link zookeeper:zookeeper \
-p 9000:9000 \
-e ZK_HOSTS="zookeeper:2181" \
hlebalbau/kafka-manager:stable \
-Dpidfile.path=/dev/null
```
如果想设置webui 的权限,可以这样设置

```bash
KAFKA_MANAGER_AUTH_ENABLED: "true"
KAFKA_MANAGER_USERNAME: username
KAFKA_MANAGER_PASSWORD: password
```

web ui in `localhost:9000`


[快速实现springboot集成Kafka](https://github.com/vector4wang/spring-boot-quick/tree/master/quick-kafka)

#### 启动服务

将上述部署的几个服务的ip和端口号分别配置在flink-2-hbase和web服务中,然后首先在flink-2-hbase中的根目录执行`mvn clean install`目的是将其打包并放置在本地仓库中,然后再分别启动task目录下的task,直接在idea中右键启动就行了;接着把SchedulerJob启动起来,定时的去结算协同过滤和用户画像所需要的分数;

然后在idea中打开web项目,等待其自动引入web-flink-hbase生成的jar包之后,最后启动服务就ok了;


所有的服务启动后,因为没有任何的点击记录,所以没有什么推荐,这里需要你在推荐页面随便点击,等达到一定的历史数据,就能实现实时推荐的效果了


### 6. 下一步工作

1. 添加前台发送kafka日志
2. 添加部署说明
3. 完善数据大屏,显示更详细的指标
4. 统计召回率/准确率等业务指标
1. 完善数据大屏,显示更详细的指标
2. 统计召回率/准确率等业务指标

Binary file modified resources/.DS_Store
Binary file not shown.
Binary file added resources/pic/system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 52268b3

Please sign in to comment.