# WebsiteTrafficStatistics **Repository Path**: guozhu_l/WebsiteTrafficStatistics ## Basic Information - **Project Name**: WebsiteTrafficStatistics - **Description**: 网站流量分析项目 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-04-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WebsiteTrafficStatistics ## 介紹 网站流量动态分析项目 ## 架構 ### Website 是采集网页访问记录的网站工程 ### KafkaConsumer 是后台Kafka收集,分析和存储用户的网页访问记录 ## Linux上需要开启的服务 ### Flume weblog.conf: ``` # 给Agent起名 # 给Source起名 a1.sources = s1 # 给Channel起名 a1.channels = c1 c2 # 给Sink起名 a1.sinks = k1 k2 # 配置Source a1.sources.s1.type = avro a1.sources.s1.bind = 0.0.0.0 a1.sources.s1.port = 44444 # 配置Channel a1.channels.c1.type = memory a1.channels.c1.capacity = 10000 a1.channels.c1.transactionCapacity = 1000 a1.channels.c2.type = memory a1.channels.c2.capacity = 10000 a1.channels.c2.transactionCapacity = 1000 # 配置Sink a1.sinks.k1.type = hdfs a1.sinks.k1.hdfs.path = hdfs://mycentos8:9000/weblog/reportTime=2020-04-13 a1.sinks.k1.hdfs.fileType = DataStream a1.sinks.k1.hdfs.rollInterval = 30 a1.sinks.k1.hdfs.rollSize = 0 a1.sinks.k1.hdfs.rollCount = 0 a1.sinks.k2.type = org.apache.flume.sink.kafka.KafkaSink a1.sinks.k2.brokerList = mycentos8:9092 a1.sinks.k2.topic = weblog # 将Source和Channel绑定 a1.sources.s1.channels = c1 c2 # 将Sink和Channel绑定 a1.sinks.k1.channel = c1 a1.sinks.k2.channel = c2 ``` 其中, "mycentos8"是Linux主机名 ### Kafka 建立topic ``` cd /home/software/kafka_2.13-2.4.1/bin sh kafka-topics.sh --create --zookeeper mycentos8:2181 --replication-factor 2 --partitions 1 --topic weblog ``` ## 启动顺序 ### 启动HDFS ### 启动ZooKeeper ### 启动Flume ``` cd /home/software/apache-flume-1.9.0-bin/bin flume-ng agent -n a1 -c /home/software/apache-flume-1.9.0-bin/data -f /home/software/apache-flume-1.9.0-bin/data/weblog.conf -Dflume.root.logger=INFO,console ``` ### 启动Kafka ``` cd /home/software/kafka_2.13-2.4.1/bin sh kafka-server-start.sh ../config/server.properties ``` ### 启动HBase ``` cd /home/software/hbase-2.2.4/bin sh start-hbase.sh ``` ### 开启Website ### 访问a.jsp, 跳转b.jsp产生访问记录 ## 安裝教程 1. xxxx 2. xxxx 3. xxxx ## 使用說明 1. xxxx 2. xxxx 3. xxxx ## 參與貢獻 1. Fork 本倉庫 2. 新建 Feat_xxx 分支 3. 提交程式碼 4. 新建 Pull Request #### 碼雲特技 1. 使用 Readme\_XXX.md 來支持不同的語言,例如 Readme\_en.md, Readme\_zh.md 2. 碼雲官方部落格 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 這個地址來瞭解碼雲上的優秀開源項目 4. [GVP](https://gitee.com/gvp) 全稱是碼雲最有價值開源項目,是碼雲綜合評定出的優秀開源項目 5. 碼雲官方提供的使用手冊 [https://gitee.com/help](https://gitee.com/help) 6. 碼雲封面人物是一檔用來展示碼雲會員風采的欄目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)