Centos6.5部署大众点评CAT
CAT (Central Application Tracking) 簡介:
? ?CAT 是大眾點評開源的一套基于java的實時應用監控平臺,主要應用于服務中間件框架(MVC 框架、RPC 框架、持久層框架、分布式緩存框架)的監控,為開發和運維提供各項性能指標、健康檢查、自動報警等可視化服務。
? 最近在公司部署大眾點評的CAT,下面是我的部署過程:
系統和軟件:
CAT GitHub網址:https://github.com/dianping/cat
Centos6.5
apache-maven-3.2.3-bin.zip
jdk-7u60-linux-x64.gz
cat-master.zip ? ? ? ??
#這個程序可以不用下載,直接git clone?https://github.com/dianping/cat.git即可
簡述安裝過程:
在最初安裝時,按時官方文檔遇到了很多小問題,最后總結其實安裝CAT很簡單,大至可分為
(1)系統準備:安裝git、jdk、mavent、mysql、tomcat(可以不裝)
(2)CAT部署:1、Clone CAT:git clone?https://github.com/dianping/cat.git
? ? ? ? ? ? ? 2、在CAT目錄下,用maven構建項目:mvn clean install -DskipTests
? ? ? ? ? ? ? 3、配置CAT的環境:進入CAT目錄: ?mvn cat:install
? ? ? ? ? ? ? 注(需要對/data/appdatas/cat和/data/applogs/cat有讀寫權限)
? ? ? ? ? ? ? 4、運行CAT,進入cat-home文件夾:mvn jetty:run
一、系統準備
安裝git
| 1 2 3 4 5 | [root@cat?~]#?yum?install?git #yum安裝git? [root@cat?~]#?git?--version #驗證版本 git?version?1.7.1 |
2.安裝mavent、jdk和解壓cat
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | [root@cat?~]#?mkdir?/application #創建上面的文件夾用來做程序文件夾 [root@cat?~]#?cd?/home/zdw/tools/ #用來存放程序文件 [root@cat?tools]#?ls apache-maven-3.2.3-bin.zip??cat-master.zip??jdk-7u60-linux-x64.gz #已上傳maven、cat、jdk文件到/home/zdw/tools/下 [root@cat?tools]#?yum?-y?install?unzip #安裝unzip解壓軟件 [root@cat?tools]#?unzip?apache-maven-3.2.3-bin.zip?-d?/application #解壓maven到/application/下 [root@cat?tools]#?ls?/application/ #已復制 apache-maven-3.2.3 [root@cat?tools]#?unzip?cat-master.zip?-d?/application #解壓cat到/application/下 [root@cat?tools]#?tar?xf?jdk-7u60-linux-x64.gz?-C?/application #解壓jdk到application下 [root@cat?tools]#?ls?/application/ 查看 apache-maven-3.2.3??cat-master??jdk1.7.0_60 |
3.配置mavent和jdk環境變量
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | [root@cat?tools]#?vi?/etc/profile #配置jdk環境變量,/application/jdk1.7.0_60是程序所放在路徑,版本不同,替換此項即可 export?JAVA_HOME=/application/jdk1.7.0_60 export?CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export?PATH=$PATH:$JAVA_HOME/bin #配置maven環境變量 export?M2_HOME=/application/apache-maven-3.2.3 export?M2=$M2_HOME/bin export?PATH=$M2:$PATH [root@cat?tools]#?source?/etc/profile [root@cat?tools]#?java?-version #java驗證 java?version?"1.7.0_60" Java(TM)?SE?Runtime?Environment?(build?1.7.0_60-b19) Java?HotSpot(TM)?64-Bit?Server?VM?(build?24.60-b09,?mixed?mode) [root@cat?tools]#?mvn?-v #mavent驗證 Apache?Maven?3.2.3?(33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4;?2014-08-12T04:58:10+08:00) Maven?home:?/application/apache-maven-3.2.3 Java?version:?1.7.0_60,?vendor:?Oracle?Corporation Java?home:?/application/jdk1.7.0_60/jre Default?locale:?en_US,?platform?encoding:?UTF-8 OS?name:?"linux",?version:?"2.6.32-431.el6.x86_64",?arch:?"amd64",?family:?"unix" |
4.安裝tomcat
| 1 2 3 4 5 6 7 | [root@cat?tools]#?tar?xf?apache-tomcat-7.0.69.tar.gz?-C?/application [root@cat?tools]#?ls?/application/ apache-maven-3.2.3??apache-tomcat-7.0.69??jdk1.7.0_60 [root@cat?application]#?pwd /application [root@cat?application]#?ln?-sv?apache-tomcat-7.0.69?tomcat `tomcat'?->?`apache-tomcat-7.0.69' |
5.安裝mysql
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@cat?~]#?yum?-y?install?mysql?mysql-server?mysql-devel [root@mysql?~]#?chkconfig?mysqld?on?????????????????????????????????? #開機啟動 [root@mysql?~]#?chkconfig?--list?|?grep?mysqld #查詢是否開機啟動 mysqld??????????0:off???1:off???2:on????3:on????4:on????5:on????6:off [root@mysql?~]#?service?mysqld?start #啟動服務 Starting?mysqld:???????????????????????????????????????????[??OK??]?? [root@mysql?~]#?mysql???????????????????????????????????????????????? #進入mysql mysql>?set?password?for?root@localhost=password('root'); #用上面的命令設置root的密碼為root mysql>?exit Bye [root@cat?~]#?mysql?-u?root?-p #進入mysql輸入剛才設置的root密碼 Enter?password: |
6.上面已經把所需要的環境準備好,現在來處理cat
注:可以直接從第11行[root@cat cat]# git clone https://github.com/dianping/cat.git 開始操作,此操作會自動下載cat文件夾及里面的內容。
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | [root@cat?application]#?cp?-r?cat-master?cat [root@cat?cat]#?pwd /application/cat [root@cat?cat]#?mvn?clean?install?-DskipTests #在CAT目錄下,用maven構建項目 [INFO]?Scanning?for?projects... [WARNING]? [WARNING]?Some?problems?were?encountered?while?building?the?effective?model?for?com.dianping.cat:cat-home:war:1.3.6 [WARNING]?The?expression?${version}?is?deprecated.?Please?use?${project.version}?instead. [WARNING]?..............................略 [root@cat?cat]#?git?clone?https://github.com/dianping/cat.git? #如果mvn?clean?install?-DskipTests不成功。使用上面命令將mvn-repo下的jar包復制到本機maven倉庫,直到最后顯示100% Initialized?empty?Git?repository?in?/cat/cat/.git/ remote:?Counting?objects:?153895,?done. remote:?Total?153895?(delta?0),?reused?0?(delta?0),?pack-reused?153895 Receiving?objects:?100%?(153895/153895),?77.30?MiB?|?32?KiB/s,?done. Resolving?deltas:?100%?(69288/69288),?done. [root@cat?cat]#?mvn?clean?install?-DskipTests #再次用maven構建項目,提示100%,完成 .............略 [INFO]?BUILD?SUCCESS [INFO]?------------------------------------------------------------------------ [INFO]?Total?time:?01:07?h [INFO]?Finished?at:?2016-05-19T16:47:05+08:00 [INFO]?Final?Memory:?33M/173M [INFO]?------------------------------------------------------------------------ [root@cat?cat]#?mvn?cat:install #配置CAT的環境,填寫數據庫地址、用戶名、密碼 Please?input?jdbc?url:[jdbc:mysql://127.0.0.1:3306] Please?input?username:root Please?input?password:[]root #1.官方文檔有說明: #2.Linux\Mac??需要對/data/appdatas/cat和/data/applogs/cat有讀寫權限 #3.正好我在操作中,出現錯誤[ERROR]?提示,根據提示,操作下面三條命令創建文件夾,并賦予讀寫權限。 [root@cat?cat]#?mkdir?-p?/data/appdatas/cat [root@cat?cat]#?chmod?777?/data/appdatas/cat [root@cat?cat]#?chmod?777?/data/applogs/cat [root@cat?cat]#?mvn?cat:install? #再次配置CAT的環境,填寫數據庫地址、用戶名、密碼,完成沒有出現錯誤 [root@cat?~]#cd?cat-home [root@cat-home]#pwd /application/cat/cat-home [root@cat-home]#mvn?jetty:run #最后,在cat-home下運行mvn?jetty:run |
到此可以用http://127.0.0.1:2281/cat/r來訪問cat
下面是tomcat下訪問cat的操作
tomcat下運行cat
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | [root@cat?target]#?pwd /application/cat/cat-home/target [root@cat?target]#?ls #在/cat-home/target下有個cat-alpha-1.3.6.war cat-alpha-1.3.6.war??cat-home-1.3.6-sources.jar??generated-sources??test-classes cat-home-1.3.6???????classes?????????????????????maven-archiver?????work [root@cat?target]#?cp?cat-alpha-1.3.6.war?/application/tomcat/webapps/cat.war #把cat-alpha-1.3.6.war改名為cat.war并復制到tomcat的webapps文件夾 [root@cat?webapps]#?pwd #進入tomcat的webapps文件夾 /application/tomcat/webapps [root@cat?webapps]#?ls cat??cat.war??docs??examples??host-manager??manager??ROOT [root@cat?webapps]#?cd?/application/tomcat/bin/ #進入tomcat的bin文件夾 [root@cat?bin]#?./startup.sh? #啟動tomcat Using?CATALINA_BASE:???/application/tomcat Using?CATALINA_HOME:???/application/tomcat Using?CATALINA_TMPDIR:?/application/tomcat/temp Using?JRE_HOME:????????/application/jdk1.7.0_60 Using?CLASSPATH:???????/application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar Tomcat?started. |
完成
? ? ? 本文轉自cix123 ?51CTO博客,原文鏈接:http://blog.51cto.com/zhaodongwei/1775133,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的Centos6.5部署大众点评CAT的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2路由策略_route-map(执行路由
- 下一篇: ORACLE---Unit04: SQL