1.linux上安裝java,Maven,并且配置相關(guān)的環(huán)境。并且安裝MySQL,Redis,Nginx,Zookeeper。
以上這些網(wǎng)上都有教程,主要說一下Redis安裝的時候在他的配置文件一定要配置至少兩個節(jié)點(diǎn),一個主的slaver和一個從的slaver。這個是單機(jī)模式ip(127.0.0.1)。
集群模式的話就得分別在配置文件中配置分布式的主的ip和從的ip和相應(yīng)的端口。啟動redis,并且驗(yàn)證能否遠(yuǎn)程訪問,端口是否正常。
2.去Git上面下載disconf-master的源碼
地址:https://codeload.github.com/knightliao/disconf/zip/master 解壓:unzip disconf-master.zip
3.創(chuàng)建兩個文件夾online-resources和war
mkdir /Hadoop/disconf/online-resources mkdir /hadoop/disconf/waronline-resources:放的是四個配置文件(四個所在文件位置disconf-master/disconf-web/PRofile/rd的目錄下) application-demo.properties(郵件配置163) jdbc-mysql.properties(mysql數(shù)據(jù)庫連接的配置) redis-config.properties(redis連接的配置) zoo.properties(zookeeper的配置)
1.首先將四個配置文件拷貝到/hadoop/disconf/online-resources 命令 cp 所在文件夾絕對路徑 目標(biāo)文件夾路徑 2.application-demo.properties改成application.properties 3.四個配置文件夾可以在這里修改了,如果熟悉redis。zookeeper的話直接修改就行,反之使用默認(rèn)就可以
4.編譯項(xiàng)目
cd disconf-master mvn clean install確保所有mvn命令能buildsuccess。 因?yàn)镸aven執(zhí)行 mvn clean install 的時候會出現(xiàn)下不到j(luò)ar包,所以的手動添加jar包(網(wǎng)上可自行搜索maven手動添加jar包)。
5.配置環(huán)境變量
ONLINE_CONFIG_PATH=/hadoop/disconf/online-resourcesWAR_ROOT_PATH=/hadoop/disconf/war export ONLINE_CONFIG_PATH export WAR_ROOT_PATH注意:執(zhí)行 source /etc/profile 否則環(huán)境變量不生效。
6.運(yùn)行deploy腳本
cd disconf-web sh deploy/deploy.sh注意:執(zhí)行過程中也會出現(xiàn)下不到j(luò)ar包,所以的手動添加jar包(網(wǎng)上可自行搜索maven手動添加jar包)。
執(zhí)行完畢會在新建的/hadoop/disconf/online-resources下出現(xiàn)如下目錄 -disconf-web.war -html -jpaas_control -META-INF -Release -tmp -WEB-INF
7.初始化數(shù)據(jù)庫
按照disconf-master/disconf-web/sql/readme.txt說明按照順序?qū)霐?shù)據(jù) 默認(rèn)username=root,passWord=123456 建議初始化完畢以后看一下其中的數(shù)據(jù) 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的容器中,這就覺得在分布式系統(tǒng)中tomcat和disconf是不可分離的必須部署到同一臺主機(jī)上。
修改server.xml文件,在Host結(jié)點(diǎn)下添加Context:
<Context path="" docBase="/hadoop/disconf/war"></Context>注意上面的路徑是war包存放的路徑,啟動tomcat之后測試遠(yuǎn)程端口能不能正常訪問。
9.配置Nginx
在http標(biāo)簽下添加以下代碼段
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/即可訪問 默認(rèn)用戶:admin/admin

新聞熱點(diǎn)
疑難解答