您好,登錄后才能下訂單哦!
目錄
創(chuàng)建OpenStack鏡像
配置Puppet Master
運(yùn)行Stratos
Troubleshooting
以下所有軟件的OS環(huán)境均為Ubuntu14.04
制作OpenStack的基礎(chǔ)鏡像Ubuntu14.04
參考:Step 1 - Spawn an instance
啟動(dòng)虛擬
修改鏡像源
# vi /etc/apt/source.list1
刪除所有官方的鏡像源,添加阿里云的鏡像源,并執(zhí)行apt-get update。
deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse12345
修改時(shí)區(qū)為中國(guó)時(shí)區(qū),Puppet Master和Agent的時(shí)間完全同步,否則會(huì)出現(xiàn)無法正常通訊的情況。
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime1
修改Python源為國(guó)內(nèi)的豆瓣提供的源,否則會(huì)出現(xiàn)鏡像制作步驟中配置cartridge時(shí)超時(shí)的問題,錯(cuò)誤信息為:pip installs-gittle timeout。
# cd ~# mkdir .pip# cd .pip# vim pip.conf1234
添加并保存如下內(nèi)容:
[global] index-url = http://pypi.douban.com/simple [install] trusted-host = pypi.douban.com1234
執(zhí)行如下命令,進(jìn)行Cartriage配置
sudo -iapt-get install zip unzip mkdir -p /root/bin cd /root/bin wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/config-scripts/ec2/config.sh;hb=HEAD" -O config.sh chmod +x config.sh wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/init-scripts/ec2/ubuntu/init.sh;hb=HEAD" -O init.sh chmod +x init.sh mkdir -p /root/bin/puppetinstall wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/puppetinstall/puppetinstall;hb=HEAD" -O puppetinstall/puppetinstall chmod +x puppetinstall/puppetinstall wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/stratos_sendinfo.rb;hb=HEAD" -O stratos_sendinfo.rb chmod +x stratos_sendinfo.rb12345678910111213
此處需要注意最后一步,官網(wǎng)的步驟中沒有對(duì)stratos_sendinfo.rb賦可執(zhí)行權(quán)限的操作。
設(shè)置時(shí)間與Puppet Master保持一致
sed -i 's:^TIMEZONE=.*$:TIMEZONE=\"Asia/Shanghai\":g' /root/bin/puppetinstall/puppetinstall1
運(yùn)行config.sh文件,此處的service-name可輸入default或者不輸入值,若輸入php,在運(yùn)行期間會(huì)出現(xiàn)php配置失敗 的情況,可能是由于puppet腳本有錯(cuò)誤。(剛配置php可以訪問ip:80,但cartriage agent運(yùn)行完后無法訪問。Stratos Application的啟動(dòng)狀態(tài)一直停留在starting,原因是程序會(huì)訪問80端口但無響應(yīng))。
參考官網(wǎng)步驟:6. Setup Puppet Master
此處注意,需要將apache-stratos-python-cartridge-agent-4.1.5.zip文件解壓后去掉4.1.5的版本號(hào)去掉后重新解壓后拷貝到puppet的modules的相關(guān)目錄下。
配置base.pp文件中的內(nèi)容時(shí),需要與nodes目錄下的其他資源的定義相符合,比如在base.pp目錄下定義 了$tomcat_version這個(gè)變量,則需要在/etc/puppet/manifests/nodes/tomcat.pp目錄下的內(nèi)容與之對(duì) 應(yīng),這樣才能正確的文件推送。
node /tomcat/ inherits base { $tomcat_version = '8.0.36' $docroot = "/mnt/apache-tomcat-${tomcat_version}/webapps/" $samlalias="/mnt/apache-tomcat-${tomcat_version}/webapps/" class {'tomcat':} }1234567
啟動(dòng)Stratos
調(diào)試運(yùn)行時(shí)可啟動(dòng)H2數(shù)據(jù)庫,連內(nèi)置CEP。
創(chuàng)建各Stratos對(duì)象
創(chuàng)建Cartridge的代碼如下:
{ "type": "java", "category": "framework", "provider": "oracle", "host": "leaptocloud.com", "displayName": "java", "description": "java Cartridge", "version": "7", "multiTenant": true, "portMapping": [ { "name": "http-22", "protocol": "http", "port": 22, "proxyPort": 8280 } ], "iaasProvider": [ { "type": "openstack", "p_w_picpathId": "RegionOne/f8850fcb-a1a5-4288-a808-2c2a0b97adcb", "property": [ { "name": "instanceType", "value": "RegionOne/2" } ], "networkInterfaces": [ { "networkUuid": "84eeb7b2-82f4-478a-b768-e24d7d0544ee" } ] } ]}1234567891011121314151617181920212223242526272829303132333435
portMapping配置需要填正確的port配置。配置錯(cuò)誤時(shí),會(huì)出現(xiàn)applicaiton無法啟動(dòng)的問題。
Cartridge agent運(yùn)行時(shí)可查看syslog日志,若出現(xiàn)不能正常啟動(dòng)或者啟動(dòng)出錯(cuò)的情況,可手動(dòng)刪除python agent進(jìn)行,修改配置后,重新運(yùn)行agent程序:
# nohup /mnt/apache-stratos-python-cartridge-agent-/agent.py &1
并查看nohup日志進(jìn)行調(diào)試運(yùn)行。
調(diào)試關(guān)鍵路徑
/root/bin/puppetinstall
/tmp/payload/launch-params
/root/bin/puppetinstall/puppetinstall
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。