Linux Centos7下Disconf分布式系統組態管理安裝__Linux

來源:互聯網
上載者:User

1.Linux上安裝Java,Maven,並且配置相關的環境。並且安裝MySQL,Redis,Nginx,Zookeeper。

以上這些網上都有教程,主要說一下Redis安裝的時候在他的設定檔一定要配置至少兩個節點,一個主的slaver和一個從的slaver。這個是單機模式ip(127.0.0.1)。

叢集模式的話就得分別在設定檔中配置分布式的主的ip和從的ip和相應的連接埠。啟動redis,並且驗證能否遠端存取,連接埠是否正常。

2.去Git上面下載disconf-master的源碼

地址:https://codeload.github.com/knightliao/disconf/zip/master
解壓:unzip disconf-master.zip

3.建立兩個檔案夾online-resources和war

mkdir /Hadoop/disconf/online-resources  mkdir /hadoop/disconf/war

online-resources:放的是四個設定檔(四個所在檔案位置disconf-master/disconf-web/profile/rd的目錄下)
application-demo.properties(郵件配置163)
jdbc-mysql.properties(mysql資料庫連接的配置)
redis-config.properties(redis串連的配置)
zoo.properties(zookeeper的配置)

1.首先將四個設定檔拷貝到/hadoop/disconf/online-resources
命令 cp 所在檔案夾絕對路徑 目標檔案夾路徑
2.application-demo.properties改成application.properties
3.四個設定檔夾可以在這裡修改了,如果熟悉redis。zookeeper的話直接修改就行,反之使用預設就可以

4.編譯項目

cd disconf-master mvn clean install  

確保所有mvn命令能buildsuccess。
因為Maven執行 mvn clean install 的時候會出現下不到jar包,所以的手動添加jar包(網上可自行搜尋maven手動添加jar包)。

5.配置環境變數

ONLINE_CONFIG_PATH=/hadoop/disconf/online-resourcesWAR_ROOT_PATH=/hadoop/disconf/war  export ONLINE_CONFIG_PATH  export WAR_ROOT_PATH  

注意:執行 source /etc/profile 否則環境變數不生效。

6.運行deploy指令碼

cd disconf-web  sh deploy/deploy.sh 

注意:執行過程中也會出現下不到jar包,所以的手動添加jar包(網上可自行搜尋maven手動添加jar包)。

執行完畢會在建立的/hadoop/disconf/online-resources下出現如下目錄
-disconf-web.war
-html
-jpaas_control
-META-INF
-Release
-tmp
-WEB-INF

7.初始化資料庫

按照disconf-master/disconf-web/sql/readme.txt說明按照順序匯入資料
預設username=root,password=123456
建議初始化完畢以後看一下其中的資料
mysql-u username -p password <0-init_table.sql
mysql-u username -p password -Ddisconf<1-init_data.sql
mysql-u username -p password -Ddisconf<201512/20151225.sql
mysql-u username -p password -Ddisconf<20160701/20160701.sql
8.配置tomcat

主要就是把上面產生的war包部署到tomcat的容器中,這就覺得在分布式系統中tomcat和disconf是不可分離的必須部署到同一台主機上。

修改server.xml檔案,在Host結點下添加Context:

<Context path="" docBase="/hadoop/disconf/war"></Context>

注意上面的路徑是war包存放的路徑,啟動tomcat之後測試遠程連接埠能不能正常訪問。

9.配置Nginx

在http標籤下添加以下程式碼片段

upstream disconf {      server 127.0.0.1:8080;  }  server {      listen   8000;      server_name localhost;      access_log logs/disconf_access.log;      error_log logs/disconf_error.log;      location / {          root /hadoop/disconf/war/html;          if ($query_string) {              expires max;          }      }      location ~ ^/(api|export) {          proxy_pass_header Server;          proxy_set_header Host $http_host;          proxy_redirect off;          proxy_set_header X-Real-IP $remote_addr;          proxy_set_header X-Scheme $scheme;          proxy_pass http://disconf;      }  }  

10.瀏覽器裡面輸入nginx的ip和連接埠訪問,通過http://你的ip:8000/即可訪問 預設使用者:admin/admin

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.