ÃÑ ÆäÀÌÁö ¼ö : 3224
![]()
|
Facebook Joinc ±×·ì
Joinc QA »çÀÌÆ®
![]()
Tweet
joinc´Â Firefox¿Í chrome¿¡¼ Å×½ºÆ® Çß½À´Ï´Ù. IE¿¡¼´Â Å×À̺íÀÌ ±úÁö°Å³ª À̹ÌÁö°¡ º¸ÀÌÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù. ƯÈ÷ ±¸±Û DocsÀ̹ÌÁöÀÇ °æ¿ì ¿¢¹Úó¸®µÉ ¼ö ÀÖ½À´Ï´Ù. 1 chef install
Ŭ¶ó¿ìµåÀÇ °¡Àå Å« À̽´ ÁßÀÇ Çϳª°¡ "¾î¶»°Ô ¼³Á¤À» ÀÚµ¿ÈÇÒ¼ö ÀÖÀ»±î?"ÀÌ´Ù. ¿¹ÄÁµ¥ automatic. ¸î °¡Áö automatic ÅøµéÀÌ ÀÖ´Â °Í °°Àºµ¥, chef¸¦ ¼±ÅÃÇß´Ù. ÀÌÀ¯´Â µý°Å ¾ø°í, ȸ»ç¿¡¼ ¾²°í Àֱ⠶§¹®.
óÀ½¿£ ±×³É ¸¸µé¾îÁ® ÀÖ´Â chef Äڵ常 ºÐ¼®Çصµ ½Ã½ºÅÛÀ» ÀÌÇØÇÒ ¼ö ÀְڰŴ϶ó°í »ý°¢Çߴµ¥, ¿ª½Ã ÇÁ·Î±×·¥Àº Á÷Á¢ ¼³Ä¡Çؼ ½ÇÇ൵ ÇØº¸°í ¿¹Á¦ ¸¸µé¾î¼ Å×½ºÆ®µµ ÇØºÁ¾ß ¸Ó¸®¼Ó¿¡ Á¤¸®°¡ µÇ´Â °Í °°´Ù. ÇØ¼ °£´ÜÇϰԳª¸¶ Á÷Á¢ ¼³Ä¡ÇØ º¸±â·Î Çß´Ù. ¿©±â¿¡´Â chef ¼³Ä¡¿Í °ü·ÃµÈ ÃÖ¼ÒÇÑÀÇ ³»¿ë¸¸ Æ÷ÇÔÇÑ´Ù. 2 ÀνºÅç ¹× Å×½ºÆ® ȯ°æ
chef server, chef client ¸ðµÎ CentOS Linux 6.2 server minimal ¹öÀüÀ» ¼±ÅÃÇß´Ù. virtualbox¸¦ ÀÌ¿ëÇØ¼ ¼³Ä¡Çß´Ù. kvmÀ̳ª vmware·Îµµ Å×½ºÆ® ȯ°æÀ» ²Ù¹Ð ¼ö ÀÖÀ» °ÍÀÌ´Ù.
Å×½ºÆ® ȯ°æÀº ´ÙÀ½°ú °°´Ù.
3 chef server ¼³Ä¡
RBEL repository¸¦ Ãß°¡ Çß´Ù. # rpm -Uvh http://rbel.frameos.org/rbel6 http://rbel.frameos.org/rbel6(À»)¸¦ º¹±¸ÇÕ´Ï´Ù °æ°í: /var/tmp/rpm-tmp.ygTNpa: Header V4 DSA/SHA1 Signature, key ID f345be74: NOKEY Áغñ Áß... ########################################### [100%] 1:rbel5-release ########################################### [100%]
chef-server ¼³Ä¡. opscodeÀÇ º¹Àâ´Ù´ÜÇÑ ¸Þ´º¾ó°ú´Â ´Þ¸® Çѹø¿¡ ¼³Ä¡ ³¡. # yum install rubygem-chef-server # ¹«·Á 87°³ÀÇ ÆÐŰÁö°¡ ¼³Ä¡ÇÑ´Ù.
setup script¸¦ ½ÇÇàÇÑ´Ù. # setup-chef-server.sh½ºÅ©¸³Æ®¸¦ ½ÇÇàÇϸé, chef server¸¦ ¿î¿ëÇϱâ À§ÇÑ ¼³Á¤ÆÄÀÏÀÌ (/etc/chef ¹Ø¿¡)¸¸µé¾îÁö°í, ¼¹ö ÇÁ·Î±×·¥µéÀÌ ÀÚµ¿À¸·Î ½ÇÇàµÈ´Ù. ¼¹ö ÇÁ·Î±×·¥µé°ú listen port¸¦ Á¤¸®Çß´Ù.
3.1 chef server ¼³Á¤
chef ¼³Á¤ÆÄÀϵéÀ» »ìÆìº¸ÀÚ. chef ¼³Á¤ ÆÄÀϵéÀº /etc/chef ¹Ø¿¡ ÀÖ´Ù. Áß¿äÇÑ °ÍÀº server.rb¿Í chef client ÀÎÁõÀ» À§ÇØ »ç¿ëÇÏ´Â private key ÆÄÀϵé (.pem)µéÀÌ´Ù. ¸ÕÀú server.rb¸¦ ¼öÁ¤. # µüÈ÷ ¼Õ´î°Ç ¾ø´Ù. log_level :info log_location STDOUT ssl_verify_mode :verify_none # chef server api port. chef_server_url "http://localhost:4000" signing_ca_path "/var/chef/ca" couchdb_database 'chef' # ¼³Á¤À» ÀúÀåÇÏ´Â cookbook µð·ºÅ丮 cookbook_path [ "/var/chef/cookbooks", "/var/chef/site-cookbooks" ] file_cache_path "/var/chef/cache" node_path "/var/chef/nodes" openid_store_path "/var/chef/openid/store" openid_cstore_path "/var/chef/openid/cstore" search_index_path "/var/chef/search_index" role_path "/var/chef/roles" validation_client_name "chef-validator" validation_key "/etc/chef/validation.pem" client_key "/etc/chef/client.pem" web_ui_client_name "chef-webui" web_ui_key "/etc/chef/webui.pem" web_ui_admin_user_name "admin" web_ui_admin_default_password "chef321go" supportdir = "/srv/chef/support" solr_jetty_path File.join(supportdir, "solr", "jetty") solr_data_path File.join(supportdir, "solr", "data") solr_home_path File.join(supportdir, "solr", "home") solr_heap_size "256M" umask 0022 Mixlib::Log::Formatter.show_time = false # mkdir ~/.chef # cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef/ # knife configure -i Overwrite /root/.chef/knife.rb? (Y/N) y Please enter the chef server URL: [http://localhost:4000] http://localhost:4000 Please enter a clientname for the new client: [root] yundream Please enter the existing admin clientname: [chef-webui] Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] .chef/webui.pem Please enter the validation clientname: [chef-validator] Please enter the location of the validation key: [/etc/chef/validation.pem] .chef/validation.pem Please enter the path to a chef repository (or leave blank): Creating initial API user... Created client[yundream] Configuration file written to /root/.chef/knife.rb 3.2 node µî·Ï
chef client°¡ chef server¿¡ Á¢¼ÓÇÏ·Á¸é, chef client°¡ ¼³Ä¡µÈ ÄÄÇ»Å͸¦ node·Î µî·ÏÇØ¾ß ÇÑ´Ù. # knife node create chef-client.yundream.com
hef client°¡ µî·ÏµÆ´ÂÁö È®ÀÎÇØ º¸ÀÚ. # knife node list chef-client.yundream.com 3.3 EDITOR ¼³Á¤
chef command line ÇÁ·Î±×·¥À» »ç¿ëÇÏ·Á¸é, »ç¿ëÇÒ ¿¡µðÅ͸¦ ÁöÁ¤ÇØÁà¾ß ÇÑ´Ù. # export EDITOR=vi 4 chef client ¼³Ä¡
chef client¸¦ ¼³Ä¡Çϱâ Àü¿¡, hostnameÀ» ¼³Á¤ÇÑ´Ù. hostname -f °á°ú°¡ chef-client.yundream.comÀ¸·Î ³ª¿Í¾ß ÇÑ´Ù. # hostname chef-client.yundream.com # hostname -f chef-client.yundream.com
RBEL repository¸¦ Ãß°¡ # rpm -Uvh http://rbel.frameos.org/rbel6 http://rbel.frameos.org/rbel6(À»)¸¦ º¹±¸ÇÕ´Ï´Ù °æ°í: /var/tmp/rpm-tmp.ygTNpa: Header V4 DSA/SHA1 Signature, key ID f345be74: NOKEY Áغñ Áß... ########################################### [100%] 1:rbel5-release ########################################### [100%]
chef-client ¼³Ä¡. ¿ª½Ã Çѹø¿¡ ³¡. # yum install rubygem-chef
kinfe¸¦ ÀÌ¿ëÇØ¼ chef client¸¦ ¼³Á¤ÇÑ´Ù. # cd /etc/chef # knife configure client ./ WARNING: No knife configuration file found Creating client configuration Write client.rb Write validation.pemÀÌ·¸°Ô Çϸé client.rb¿Í validation.pem ÆÄÀÏÀÌ ¸¸µé¾îÁø´Ù. chef_server_urlÀ» chef server ÁÖ¼Ò·Î ¼öÁ¤ÇÑ´Ù. log_level :info log_location STDOUT chef_server_url 'http://192.168.56.2:4000' validation_client_name 'chef-validator'
chef cleint°¡ chef server¿¡ Á¢¼ÓÇÏ·Á¸é private key¸¦ µî·ÏÇØ¾ß ÇÑ´Ù. scp¸¦ ÀÌ¿ëÇØ¼ chef server¿¡ ÀÖ´Â validateion.pemÀ» º¹»çÇÑ´Ù. # cd /etc/chef # scp root@chef-server.yundream.com:/etc/chef/validation.pem ./ÀÌÁ¦ chef-client¸¦ ½ÇÇàÇϸé, client.pemÀÌ ¸¸µé¾î Áø´Ù. ¾ÕÀ¸·Î´Â client.pemÀ» ÀÌ¿ëÇØ¼ ÀÎÁõÀ» ÇÏ°Ô µÇ´Ï, º¸¾È»ó validation.pemÀº Áö¿ìµµ·Ï ÇÑ´Ù. # chef-client 4.1 ù¹øÂ° cookbook ¸¸µé±â
ù¹øÂ° cookbookÀ» ¸¸µé¾î º¸ÀÚ. cookbookÀÇ À̸§Àº HelloWorld·Î /tmp µð·ºÅ丮 ¹Ø¿¡ HelloWorld.txtÆÄÀÏÀ» ¸¸µç´Ù. chef server¿¡¼ knife¸¦ ÀÌ¿ëÇØ¼ cookbookÀ» ¸¸µç´Ù. cookbookÀ» ¸¸µé±â À§Çؼ´Â attributes, recipes, templates µî ´Ù¾çÇÑ ¿ä¼ÒµéÀ» ¾Ë°í ÀÖ¾î¾ß Çϴµ¥, ¿©±â¿¡¼´Â À̵éÀ» ¼³¸íÇÏÁö ¾ÊÀ» °ÍÀÌ´Ù. # knife cookbook create HelloWorld ** Creating cookbook HelloWorld ** Creating README for cookbook: HelloWorld ** Creating metadata for cookbook: HelloWorld/var/chef/cookbooks µð·ºÅ丮 ¹Ø¿¡ HelloWorld µð·ºÅ丮°¡ ¸¸µé¾îÁø°É È®ÀÎÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.
HelloWorld/attributes/HelloWorld.rb ¹®¼¸¦ ¸¸µç´Ù. cookbook¿¡¼ »ç¿ëÇÒ ¼Ó¼ºµéÀ» Á¤ÀÇ ÇÑ´Ù. # message¶ó´Â º¯¼ö¸¦ Á¤ÀÇÇß´Ù´Â Á¤µµ·Î ÀÌÇØÇÏ°í ³Ñ¾î°¡ÀÚ. default['message']="Hello world!!"
HelloWorld/recipes/default.rb¸¦ ¼öÁ¤ÇÏÀÚ. # HelloWorld.txt.erb¶ó´Â template ÆÄÀÏÀ» ÀÌ¿ëÇØ¼
# /tmp/HelloWorld.txt ÆÄÀÏÀ» ¸¸µé°Ú´Ù´Â Àǹ̴Ù.
template "/tmp/HelloWorld.txt" do
source "HelloWorld.txt.erb"
variables :message => node['message']
action :create
end
ÅÛÇø´ ÆÄÀÏÀ» ¸¸µé Â÷·Ê´Ù. HelloWorld/template/default/HelloWorld.txt.erb ÆÄÀÏÀ» ¸¸µç´Ù. My Message is : <%= @message %>
¸¸µç cookbook¸¦ ¾÷·Îµå ÇÑ´Ù. # knife cookbook upload -a -o ./ Uploading HelloWorld [0.0.1] upload completeÀÌÁ¦ chef client´Â HelloWorld cookbookÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ°Ô µÆ´Ù. ±×·¯³ª ¾Æ¹« chef client³ª ÀÌ cookbookÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ´Â °Ç ¾Æ´Ï´Ù. chef server¿¡ µî·ÏÇÑ node¸¸ÀÌ ÀÌ cookbookÀ» »ç¿ëÇÒ ¼ö ÀÖ´Ù. chef-client.yundream.com node°¡ HelloWorld¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÏÀÚ. # knife node run_list add chef-client.yundream.com 'recipe[HelloWorld]' run_list: recipe[HelloWorld] # knife node show chef-client.yundream.com -r run_list: recipe[HelloWorld]
chef client¿¡¼ chef-client¸¦ ½ÇÇàÇØ º¸ÀÚ. # chef-client [Wed, 15 Feb 2012 00:14:16 +0900] INFO: *** Chef 0.10.6 *** [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Run List is [recipe[HelloWorld]] [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Run List expands to [HelloWorld] [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Starting Chef Run for chef-client.yundream.com [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Running start handlers [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Start handlers complete. [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Loading cookbooks [HelloWorld] [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Storing updated cookbooks/HelloWorld/recipes/default.rb in the cache. [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Processing template[/tmp/HelloWorld.txt] action create (HelloWorld::default line 10) [Wed, 15 Feb 2012 00:14:17 +0900] INFO: template[/tmp/HelloWorld.txt] updated content [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Chef Run complete in 0.316655 seconds [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Running report handlers [Wed, 15 Feb 2012 00:14:17 +0900] INFO: Report handlers complete¼³Á¤ÀÌ ¾÷µ¥ÀÌÆ®µÇ¾ú´Ù´Â ¸Þ½ÃÁö¸¦ È®ÀÎÇÒ ¼ö ÀÖ´Ù. # cat /tmp/HelloWorld.txt My Message is : Hello world!!¿øÇß´øµ¥·Î /tmp/HelloWorld.txt ÆÄÀÏÀÌ ¸¸µé¾îÁ³´Ù. 5 chef server ÃʱâÈ
chef´Â »ó´çÈ÷ ¸¹Àº ¼ÒÇÁÆ®¿þ¾î ÆÐŰÁöÀÇ Á¶ÇÕÀÌ´Ù. ƯÈ÷ rabbitmq-server ¶óµç°¡ couchdb°°Àº °æ¿ì¿¡´Â µ¥ÀÌÅ͸¦ °ü¸®Çϱ⠶§¹®¿¡, ÆÐŰÁö¸¦ »èÁ¦ÇÑ ÈÄ¿¡µµ Á¤º¸ÆÄÀÏÀÌ ¿©ÀüÈ÷ ³²¾Æ ÀÖ´Ù. ÀÌ »óÅ¿¡¼ chef server¸¦ ¼³Ä¡Çϸé, ÀÌÀü Á¤º¸¿Í ²¿ÀÌ°Ô µÈ´Ù. µû¶ó¼ ÆÐŰÁö¸¦ »èÁ¦Çϰí, ÆÄÀϱîÁö ÃßÀûÇØ¼ »èÁ¦ÇØ¾ß ÇÑ´Ù.
»èÁ¦ ÆÐŰÁö ¸ñ·Ï
6 ¾ÕÀ¸·Î ÇÒÀÏ
|
|
|||
|
EmailÀ» ±âÀÔÇϸé, ´ñ±ÛÀÌ ¸ÞÀÏ·Î Àü´ÞµË´Ï´Ù. |
|