寰湇鍔″涔犱箣thrift浠嬬粛瀹夎

Posted 鎴戠殑灏忕姹?/a> 寰

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了寰湇鍔″涔犱箣thrift浠嬬粛瀹夎相关的知识,希望对你有一定的参考价值。

鐐瑰嚮钃濆瓧鍏虫敞 馃憜馃憜


闃呰鏈枃澶х害闇€瑕?鍒嗛挓銆?/span>


鏈€杩戝湪鍋氫竴涓猟ocker+Kubernetes寰湇鍔″鍣ㄥ寲瀹炴垬椤圭洰锛岄」鐩腑鐢ㄥ埌浜嗗緢澶氫笉鐔熸倝鐨勭粍浠讹紝涔熼亣鍒颁簡鎸哄鐨勯棶棰樸€傞」鐩粨鏋勬槸杩欐牱鐨勶細



鍦ㄥ仛淇℃伅鏈嶅姟鐨勬椂鍊欓渶瑕佸畨瑁卼hrift缁勪欢锛岄亣鍒颁簡鐐瑰効闂锛岀壒姝よ褰曚笅杩囩▼銆?/span>


棣栧厛鏉ヨ涓€涓媡hrift锛?/span>


浠€涔堟槸thrift?


绠€鍗曟潵璇?鏄疐acebook鍏竷鐨勪竴娆惧紑婧愯法璇█鐨凴PC妗嗘灦.



浠€涔堟槸RPC妗嗘灦?


RPC鍏ㄧО涓篟emote Procedure Call,鎰忎负杩滅▼杩囩▼璋冪敤锛屽父鐢ㄧ殑rpc妗嗘灦鏈塼hrift銆乨ubbo銆乬rpc銆乵otan绛夈€?/span>


鍋囪鏈変袱鍙版湇鍔″櫒A锛孊銆侫鏈嶅姟鍣ㄤ笂閮ㄧ讲鐫€涓€涓簲鐢╝锛孊鏈嶅姟鍣ㄤ笂閮ㄧ讲鐫€涓€涓簲鐢╞,鐜板湪a甯屾湜鑳藉璋冪敤b搴旂敤鐨勬煇涓嚱鏁?鏂规硶),浣嗘槸浜岃€呬笉鍦ㄥ悓涓€涓繘绋嬪唴,涓嶈兘鐩存帴璋冪敤,灏遍渶瑕侀€氳繃缃戠粶浼犺緭,鍦ˋB鏈嶅姟鍣ㄤ箣闂村缓涓€鏉$綉缁滀紶杈撻€氶亾,a鎶婂弬鏁颁紶杩囧幓,b鎺ユ敹鍒板弬鏁拌皟鐢ㄨ嚜宸辩殑鏂规硶,寰楀埌缁撴灉,鍐嶉€氳繃缃戠粶浼犲洖缁檃,绠€鍗曡灏辨槸A閫氳繃缃戠粶鏉ヨ皟鐢˙鐨勮繃绋?杩欎釜杩囩▼瑕佹秹鍙婄殑涓滆タ寰堝,姣斿澶氱嚎绋?Socket,搴忓垪鍖栧弽搴忓垪鍖?缃戠粶I/O,寰堝鏉?浜庢槸鐗涙幇鐨勭▼搴忓憳鎶婅繖浜涘皝瑁呰捣鏉ュ仛鎴愪竴濂楁鏋?渚涘ぇ瀹朵娇鐢?灏辨槸RPC妗嗘灦銆傘€€銆€銆€銆€銆€



thrift鐨勮法璇█鐗瑰瀷


thrift閫氳繃涓€涓腑闂磋瑷€IDL(鎺ュ彛瀹氫箟璇█)鏉ュ畾涔塕PC鐨勬暟鎹被鍨嬪拰鎺ュ彛,杩欎簺鍐呭鍐欏湪浠?thrift缁撳熬鐨勬枃浠朵腑,鐒跺悗閫氳繃鐗规畩鐨勭紪璇戝櫒鏉ョ敓鎴愪笉鍚岃瑷€鐨勪唬鐮?浠ユ弧瓒充笉鍚岄渶瑕佺殑寮€鍙戣€?姣斿java寮€鍙戣€?灏卞彲浠ョ敓鎴恓ava浠g爜,c++寮€鍙戣€呭彲浠ョ敓鎴恈++浠g爜,鐢熸垚鐨勪唬鐮佷腑涓嶄絾鍖呭惈鐩爣璇█鐨勬帴鍙e畾涔?鏂规硶,鏁版嵁绫诲瀷,杩樺寘鍚湁RPC鍗忚灞傚拰浼犺緭灞傜殑瀹炵幇浠g爜.



thrift鐨勫崗璁爤缁撴瀯


寰湇鍔″涔犱箣thrift浠嬬粛瀹夎


thrift鏄竴绉峜/s鐨勬灦鏋勪綋绯?鍦ㄦ渶涓婂眰鏄敤鎴疯嚜琛屽疄鐜扮殑涓氬姟閫昏緫浠g爜.绗簩灞傛槸鐢眛hrift缂栬瘧鍣ㄨ嚜鍔ㄧ敓鎴愮殑浠g爜锛屼富瑕佺敤浜庣粨鏋勫寲鏁版嵁鐨勮В鏋愶紝鍙戦€佸拰鎺ユ敹銆俆Server涓昏浠诲姟鏄珮鏁堢殑鎺ュ彈瀹㈡埛绔姹傦紝骞跺皢璇锋眰杞彂缁橮rocessor澶勭悊銆侾rocessor璐熻矗瀵瑰鎴风鐨勮姹傚仛鍑哄搷搴旓紝鍖呮嫭RPC璇锋眰杞彂锛岃皟鐢ㄥ弬鏁拌В鏋愬拰鐢ㄦ埛閫昏緫璋冪敤锛岃繑鍥炲€煎啓鍥炵瓑澶勭悊銆備粠TProtocol浠ヤ笅閮ㄥ垎鏄痶hirft鐨勪紶杈撳崗璁拰搴曞眰I/O閫氫俊銆俆Protocol鏄敤浜庢暟鎹被鍨嬭В鏋愮殑锛屽皢缁撴瀯鍖栨暟鎹浆鍖栦负瀛楄妭娴佺粰TTransport杩涜浼犺緭銆俆Transport鏄笌搴曞眰鏁版嵁浼犺緭瀵嗗垏鐩稿叧鐨勪紶杈撳眰锛岃礋璐d互瀛楄妭娴佹柟寮忔帴鏀跺拰鍙戦€佹秷鎭綋锛屼笉鍏虫敞鏄粈涔堟暟鎹被鍨嬨€傚簳灞侷O璐熻矗瀹為檯鐨勬暟鎹紶杈擄紝鍖呮嫭socket銆佹枃浠跺拰鍘嬬缉鏁版嵁娴佺瓑銆?br>



涓嬮潰浠嬪湪Centos7.2涓婂畨瑁卼hrift锛?/span>


Thirft涓嬭浇瀹夎锛?/span>


杩欓噷瀹夎婧愮爜鍖咃紝鍗冲悗缂€鏄痶ar.gz 鎴栬€?tgz鍖咃細


wget http://mirrors.tuna.tsinghua.edu.cn/apache/thrift/0.11.0/thrift-0.11.0.tar.gz


鏌ョ湅README鍜孖NSTALL鏂囦欢锛屾牴鎹甊EADME鍜孖NSTALL鏂囦欢锛屾煡鐪媡hrift瀹夎璇存槑浠ュ強thrift渚濊禆鐨勮蒋浠跺寘锛岀劧鍚庤В鍘嬫簮鐮佸寘锛?/span>


tar -zxf thrift-0.11.0.tar.gz


婧愮爜鍖呯涓€姝ラ渶瑕佸厛鎵ц浠ヤ笅鍛戒护锛宼arball锛堝嵆鍚庣紑鏄?tar鐨勫寘锛変笉闇€瑕侊細


./bootstrap.sh


鐒跺悗鐩存帴杩愯杞欢鏍圭洰褰曚笅鐨刢onfigure鑴氭湰


./configure


鏌ョ湅鍥炴樉锛屾樉绀簀ava鍜宲ython銆乬o缂栬瘧yes锛屽叾浠栫殑no缂栬瘧銆?/span>

寰湇鍔″涔犱箣thrift浠嬬粛瀹夎

寰湇鍔″涔犱箣thrift浠嬬粛瀹夎


鍥犱负鎴戝彧闇€瑕佺紪璇慾ava鍜宲ython銆乬o锛屽叾浠栫殑鍙互蹇界暐涓嶇銆?/span>

杩欓噷闇€瑕佹彁鍓嶅畨瑁単o鐨勭幆澧冿紝鍙互鍙傝€冿細https://www.jianshu.com/p/b2222fc04f47

杩欓噷鏈変竴鐐归渶瑕佹敞鎰忥紝鏈潵宸茬粡瀹夎浜唈dk锛岀敤java -version鐪嬪埌鐨?span class="mq-94">鐗堟湰1.8鐨刯dk銆?/span>

浣嗘槸./configure鎵ц瀹宩ava杩樻槸no銆傜劧鍚庢煡鐪媍onfigure鏂囦欢閲屾湁濡備笅鐨勪唬鐮侊細

寰湇鍔″涔犱箣thrift浠嬬粛瀹夎


澶ф鎰忔€濇槸thrift缂栬瘧java闇€瑕乯dk鍜宎nt锛岀劧鍚庡啀鎵цant -version鍙戠幇纭疄娌℃湁瀹夎ant銆傞偅灏卞畨瑁卆nt鍛楋細


瀹夎ant锛?/span>

杩欓噷椤轰究瀹変簡涓€涓媘aven銆?/span>

wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven
yum -y install ant


寰湇鍔″涔犱箣thrift浠嬬粛瀹夎


ant瀹夎濂戒簡锛?/span>

寰湇鍔″涔犱箣thrift浠嬬粛瀹夎


濡傛灉浣犱篃閬囧埌./configure鎵ц瀹宩ava鍚庨潰鏄痭o鐨勬儏鍐碉紝浣犲氨寰楅鍏堟鏌dk鍜宎nt浜嗐€?br>

涓嬮潰缁х画鎵ц瀹夎thrift鐨勬楠わ細


#浣跨敤make鍛戒护杩涜缂栬瘧
make
#浣跨敤make install鍛戒护杩涜瀹夎
make install


鏈€鍚庨獙璇侊細


杈撳叆thrift -version鍛戒护锛屾煡鐪嬭緭鍑轰俊鎭垽鏂璽hrift鏄惁瀹夎鎴愬姛


$ thrift -version
Thrift version 0.11.0


濡備笂鍥炴樉锛岃鏄巘hrift瀹夎鎴愬姛锛岃嚦姝わ紝浣犲彲浠ュ埄鐢╰hrift杩涜寮€鍙戝疄鐜般€?br>



windows瀹夎璇峰弬鑰冿細

https://www.jianshu.com/p/42e4b5919434




绂忓埄锛?/span>

鏈€杩戝垰涓婄殑璇剧▼鈥斺€旂畻娉曚笌鏁版嵁缁撴瀯涔嬬編锛屽垰鎺ㄥ嚭涓嶅埌涓ゅぉ锛屽氨鏈?span>2涓?/strong>浜鸿喘涔帮紝浜掕仈缃戝ぇstormzhang寮犲摜寮哄姏鎺ㄨ崘锛岀浉褰撶伀鐖嗭紝鐜板湪璁㈣喘杩樻湁浠ヤ笅绂忓埄锛?/span>


绂忓埄涓€锛?/span>闄愭椂浼樻儬浠仿?8锛屽師浠仿?9锛?鏈?0鏃ユ仮澶嶅師浠凤紱

绂忓埄涓夛細姣忛個璇蜂竴浣嶅ソ鍙嬭喘涔帮紝浣犲彲鑾峰緱24鍏?/span>鐜伴噾杩旂幇锛屽幓鏋佸鏃堕棿App鐢熸垚浣犵殑涓撳睘閭€璇锋捣鎶ュ惂锛堢敓鎴愭祦绋嬶細鎴戠殑-鍒嗕韩鏈夎祻-鑾峰彇娴锋姤锛夛紝閭€璇?浜虹浉褰撲簬鍏嶈垂瀛︽璇剧▼銆?/strong>


濡備綍璁㈤槄锛?/strong>


鎵弿涓嬪浘浜岀淮鐮侊紝绔嬪嵆璇曡鎴栬闃呮涓撴爮銆?/span>


寰湇鍔″涔犱箣thrift浠嬬粛瀹夎

 



璇剧▼鍒嗕负鍏ラ棬绡?nbsp;-->> 鍩虹绡?nbsp;-->> 楂樼骇绡?-->> 瀹炴垬绡囥€?/span>


鏈枃鐢扁€滃9浼寸紪杈戝櫒鈥濇彁渚涙妧鏈敮鎸?/span>


寰湇鍔″涔犱箣thrift浠嬬粛瀹夎


鎺ㄨ崘闃呰锛?/span>





鍘嗗彶鏂囩珷锛?/span>




鏈枃鐢扁€滃9浼寸紪杈戝櫒鈥濇彁渚涙妧鏈敮鎸?/span>

鎴戞槸灏忕姹わ紝鎴戜滑涓€璧峰涔犮€?/span>

鎵爜鍏虫敞锛岀簿褰╁唴瀹圭涓€鏃堕棿鎺ㄧ粰浣?/span>


以上是关于寰湇鍔″涔犱箣thrift浠嬬粛瀹夎的主要内容,如果未能解决你的问题,请参考以下文章

Ansible 鏁欑▼锛氱畝鍗?Ansible 鍛戒护浠嬬粛 | Linux 涓浗

1 . STM32CubeMX浠嬬粛

.net寰俊鍏紬鍙峰紑鍙戔€斺€旀秷鎭笌浜嬩欢

浠嬬粛axios鍜宲romise

Go --- 鍩虹浠嬬粛