ÔËά¹¤¾ßSaltStack¼ò½é£¨Èý£©

¡º¸ÊËàÁúÍøÕªÒª_ÔËά¹¤¾ßSaltStack¼ò½é£¨Èý£©¡»ÕⲨ²Ù×÷¿´ÉÏÈ¥ÊDz»ÊǷdz£µÄ¼òµ¥£¬¼òÖ±666.³ýÁËͨ¹ýÃüÁîÐвÙ×÷saltstack»¹ÌṩÁËrestful api¹©ÎÒÃǵ÷Ó㬻¹¼ÇµÃÎÒÃÇ°²×°ÁËsalt-apiÕâ¸öÄ£¿éÂð£¬Õâ¸ö¾ÍÊÇsaltstackµÄapi·þÎñÄ£¿é¡£µ±È»ËüÒ²ÐèÒª¼òµ¥µÄ½øÐÐÅäÖᣠ# Åä...


ÕⲨ²Ù×÷¿´ÉÏÈ¥ÊDz»ÊǷdz£µÄ¼òµ¥£¬¼òÖ±666.³ýÁËͨ¹ýÃüÁîÐвÙ×÷saltstack»¹ÌṩÁËrestful api¹©ÎÒÃǵ÷Ó㬻¹¼ÇµÃÎÒÃÇ°²×°ÁËsalt-apiÕâ¸öÄ£¿éÂð£¬Õâ¸ö¾ÍÊÇsaltstackµÄapi·þÎñÄ£¿é¡£µ±È»ËüÒ²ÐèÒª¼òµ¥µÄ½øÐÐÅäÖá£

# ÅäÖÃÓû§useradd -M -s /sbin/nologin adminpasswd admin # ÅäÖÃsalt-master vi /etc/salt/master.d/saltapi.conf# ²åÈëÈçÏÂÄÚÈÝ rest_cherrypy: port: 8000 host: 0.0.0.0 disable_ssl: trueexternal_auth: pam: admin: - .* - '@runner' - '@wheel'

ÖØÆômasterºÍapi

systemctl restart salt-mastersystemctl restart salt-api # ²é¿´apiÊÇ·ñÆô¶¯netstat -tnlp | grep 8000

1. apiÏà¹ØÓ÷¨¼°api½Ó¿Ú²Î¿¼¹Ù·½Îĵµ ¹Ù·½Îĵµ

2. °²×°web ui½øÐзÃÎÊ Ö÷Á÷web uiÓÐhalite ºÍsaltshaker ¡£

ÕâÀïÎÒÃÇÖ»½²ÊöÈçºÎͨ¹ý³ÌÐòµ÷ÓÃSalt-Api£¬ÓÉÓÚSaltStackÊÇ»ùÓÚPythonÓïÑÔ¿ª·¢µÄ£¬ËùÒÔÎÒÃǼòµ¥½éÉÜÒ»ÏÂÈçºÎͨ¹ýPython³ÌÐò²Ù×÷SaltStack£¬µ±È»ÎÒÃÇÒ²¿ÉÒÔͨ¹ýJavaµ÷ÓÃsalt-api£¬Java¿ÉÒÔͨ¹ý¿ªÔ´Ä£¿ésalt-netapi-client salt-netapi-clientʵÏÖ£¬Í¨¹ýpomÒýÓü´¿É£¬ÏêÇé¿É¿´ÆäʾÀý´úÂë¡£

ÎÞÂÛÊÇͨ¹ýPython»¹ÊÇJavaÁ½ÕßÂß¼­Ò»Ö£¬´ó¸Å·ÖΪÈçϼ¸¸ö²½Ö裺

1. ¹¹ÔìsaltclientʾÀý£¬Ê¹ÓÃsaltstackÓû§ÃûºÍÃÜÂë½øÐеǼ£¬»ñÈ¡·ÃÎÊtoken

2. Ö´ÐÐÏà¹ØÖ¸Á»ñÈ¡·µ»ØÖµ

3. ½âÎö·µ»Ø½á¹û½øÐÐչʾ

²âÊÔ³ÌÐò£º

import salt.client import salt.config client = salt.client.LocalClient() master = salt.config.client_config('/etc/salt/master') minion = salt.config.minion_config('/etc/salt/minion') ping_result = client.cmd('*', 'test.ping') print ping_result{'datanode-1': True, 'namenode-1': True, 'datanode-3': True, 'datanode-2': True, 'datanode-4': True}

ÍƼö

³±¡¤¿Æ¼¼

Á³Æ¤ºñ¡¢ÇéÉ̸ߡ¢»á½²»°£¡º¼ÖÝÄêÇáÈËÑÛÖеÄÐÂÖ°Òµ£¬¾ÓÈ»ÊÇÕâÑùµÄ¡­¡­

ÔĶÁ(32)

º¼Öݵĸ÷ÀàÖ±²¥»ú¹¹Ò²ÈçÓêºó´ºËñ£¬Ö÷²¥ÐÐÒµ³ÊÏÖ³öÄêÇữ¡¢¹æ·¶»¯ºÍ±ê×¼»¯µÄÇ÷ÊÆ£¬²»ÉÙ´óѧ±ÏÒµÉú°Ñ±ÏÒµºóµÄµÚÒ»·Ý¹¤×÷Ëø¶¨ÔÚÁË¡°Ö÷²¥¡±¡£ À´×ÔÖØÇìµÄ95ºóÕÔÕÔ£¬´óѧ¾Í¶ÁÓÚÒ½¿Æ...

³±¡¤¿Æ¼¼

áéÖÝÊÐáé½­ÇøÓªÉÌ°ì¾ÙÐС°áé½­ÇøÐÅÓÃÖÇÖÎ×ۺϹÜÀíϵͳ¡±ÉÏÏßÆô¶¯ÒÇʽ

ÔĶÁ(11)

¬ÌṩÃñÉú¡¢ÐÅÓᢽðÈÚµÈNÀàÐÅÓó¡¾°¡£Íõ¼ÌÃ÷Ö¸³ö£¬áé½­ÇøÐÅÓÃÖÇÖÎ×ۺϹÜÀíϵͳµÄ¿ª·¢ÉÏÏßÊÇáé½­ÇøÐÅÓÃÌåϵ½¨É蹤×÷È¡µÃµÄ½×¶ÎÐÔÖØÒª³É¹û£¬Ò²ÊÇáéÖÝÊС¶´òÔì¡°ÐÅÓÃʾ·¶Ö®³Ç¡±...

³±¡¤¿Æ¼¼

¿áÎÒ|»ªÎªÐû²¼Ð¹棬ÀÏÓû§Ó­À´¸£Àû£¬ÈÙÒ«Óû§Ò²Ã»±»¡°Å×Æú¡±£¿

ÔĶÁ(34)

º£Ë¼÷è÷ëµÄ³öÏָıäÁË»ªÎªµÄ·¢Õ¹Â·Ïߣ¬Í¬Ê±Ò²¸Ä±äÁËÎÒÃǶԹú²úÊÖ»úµÄÈÏÖª¡£´Ó»ªÎªMate7ʱ´ú¿ªÊ¼£¬»ªÎª¾Í×ßÏòÁË×ÔÖ÷¸ß¶ËµÄ²úƷ·Ïߣ¬Èç½ñµÄMate40ϵÁÐÒѾ­Äܹ»³É¹¦ºÍiPhone12µÈÆì½¢¶Ô...

³±¡¤¿Æ¼¼

СÃ׿Ƽ¼|»ªÎªMate50Pro¸ÅÄî»ú£º97%ÆÁÕ¼±ÈÅäºóÖÃ6¾µÍ·£¬±ÈСÃ×11Ç¿¶àÁË

ÔĶÁ(20)

ÑÓÐøÁ˷dz£¾­µäµÄÆÙ²¼ÆÁÔìÐÍ£¬Ö»²»¹ýÆÙ²¼±ß¿òÏÔµÃÉÔ΢խÁ˵㣬¶øÆÁĻȡÏûÁË´ò¿×¾µÍ·µÄͬʱ£¬»¹Äܹ»ÊµÏÖ3DÈËÁ³Ê¶±ðºÍÆÁϾµÍ·¹¦ÄÜ¡£Æäʵ¾ÍÊǽ«Ç°¾µÍ·²ØÔÚÆÁÄ»ÏÂÃ棬¶ø3DÈËÁ³Ê¶±ð...

³±¡¤¿Æ¼¼

Á³Æ¤ºñ¡¢ÇéÉ̸ߡ¢»á½²»°£¡º¼ÖÝÄêÇáÈËÑÛÖеÄÐÂÖ°Òµ£¬¾ÓÈ»ÊÇÕâÑùµÄ¡­¡­

ÔĶÁ(32)

º¼Öݵĸ÷ÀàÖ±²¥»ú¹¹Ò²ÈçÓêºó´ºËñ£¬Ö÷²¥ÐÐÒµ³ÊÏÖ³öÄêÇữ¡¢¹æ·¶»¯ºÍ±ê×¼»¯µÄÇ÷ÊÆ£¬²»ÉÙ´óѧ±ÏÒµÉú°Ñ±ÏÒµºóµÄµÚÒ»·Ý¹¤×÷Ëø¶¨ÔÚÁË¡°Ö÷²¥¡±¡£ À´×ÔÖØÇìµÄ95ºóÕÔÕÔ£¬´óѧ¾Í¶ÁÓÚÒ½¿Æ...

³±¡¤¿Æ¼¼

áéÖÝÊÐáé½­ÇøÓªÉÌ°ì¾ÙÐС°áé½­ÇøÐÅÓÃÖÇÖÎ×ۺϹÜÀíϵͳ¡±ÉÏÏßÆô¶¯ÒÇʽ

ÔĶÁ(11)

¬ÌṩÃñÉú¡¢ÐÅÓᢽðÈÚµÈNÀàÐÅÓó¡¾°¡£Íõ¼ÌÃ÷Ö¸³ö£¬áé½­ÇøÐÅÓÃÖÇÖÎ×ۺϹÜÀíϵͳµÄ¿ª·¢ÉÏÏßÊÇáé½­ÇøÐÅÓÃÌåϵ½¨É蹤×÷È¡µÃµÄ½×¶ÎÐÔÖØÒª³É¹û£¬Ò²ÊÇáéÖÝÊС¶´òÔì¡°ÐÅÓÃʾ·¶Ö®³Ç¡±...

¶¯Âþ

ÍõÕßÈÙÒ«Âþ»­¡¢ÊØÔ¼ÓÃÌ×·¶Ô×Ô¼ºµÜµÜ£¬µ«Ã»Ïëµ½µÜµÜ²»°´Ì×·À´£¿

ÔĶÁ(30)

µ«Ã»Ïëµ½µÜµÜ¸ù±¾²»°´Ì×·À´£¬Ö±½ÓÌø¹ýÁËËùÓÐÊ߲ˣ¬ÕâÈÃÊØÔ¼ºÜÊÇ¿àÄÕ¡£°ÙÀïÊØÔ¼Ó¦¸ÃÔõÑù²ÅÄܸĵôµÜµÜÌôʳµÄ»µÃ«²¡£¬ÈÃËû¶à³ÔÊ߲ˣ¬¶à³ÔË®¹ûÄØ£¿Ò»¸öÈËÖªµÀ×Ô¼ºÎªÊ²Ã´¶ø»î£¬¾Í...

³±¡¤¿Æ¼¼

ÔËÓªÉÌ|ÃÀ¹úÈ¡ÏûÍËÊУ¡±äÁ³À´µÃÌ«¿ì£¬Èý´óÔËÓªÉÌʼÁÏδ¼°£¿

ÔĶÁ(44)

¸Û¹É5ÈÕÔç¼äÐÐÇéÏÔʾ£¬ÖйúµçÐÅ¡¢ÖйúÒƶ¯¡¢ÖйúÁªÍ¨¾ùÕdz¬5%¡£´ÓÀÕÁîÍËÊе½È¡ÏûÍËÊУ¬ÖмäÒ²²»¹ýºÄ·ÑÁË5ÌìµÄʱ¼ä£¬ËûÃÇÕâ¸ö±äÁ³µÄËٶȹûÈ»ÊÇ¡°ÊÀ½çµÚÒ»¡±£¬Èý´óÔËÓªÉ̹À¼Æµ½ÏÖ...

»á¡¤Éú»î

Âþ»ÄÕ¦°ì

ÔĶÁ(28)

ÓÐʱ¿Ì·¢Ã÷¿ÉÒÔ¿´µÄҲû±£³ÖÏÂÈ¥£¬¾ÍÊDz»¸ÐÐËȤ£¬»¹ÒªµÈ´ýÕæÕý°®ºÃµÄ·¬°¡...

³±¡¤¿Æ¼¼

Áãë´Íæ¼Ò|Èý¹úÖ¾Õ½ÂÔ°æ:ÄÚÕþ½«Íê³ÉÒ»´Î10000Õ½¹¦µÄÊÆÈçÆÆÖñ¡¢ÏòËÀ¶øÉú³É¾Í

ÔĶÁ(11)

ÆäʵÕâЩ³É¾ÍÖ»ÊÇ¿´ÆðÀ´ÄÑ£¬ÎÒ¾õµÃ²ß»®¶¼ÒѾ­¸øÄãÏëºÃ°ì·¨ÁË¡£ÏÂÃæÊÇÄãÐèÒª×öµÄ×¼±¸³É¾Í£ºµÇ·åÔ켫¡¢ÓñøÈçÉñ¡¢ÊÆÈçÆÆÖñ¡¢ÏòËÀ¶øÉúÐèÒª×öµÄ×¼±¸²ÄÁÏ£º1¡¢Ð¡ºÅ1¸ö»òÕßС»ï°é1ÈË...

¶¯Âþ

´óÕ½|¡¶¸ßУ֮Éñ¡·ÉÏÑÝ¡°ÌæÉí¡±´óÕ½£¬Õⲿз¬Ô½À´Ô½ÓÐÒâ˼ÁË£¡

ÔĶÁ(19)

È»¶øÔ¤ÈȲ¿·Ö¾ÍºÜÎüÒýÈË£¬¸ü±ð˵ÕæÕýµÄ¾çÇéÁË¡£ÔÚ¶¯»­µÚ¶þ¼¯£¬ÄÐÖ÷³ÂëÀûÒòΪ˽×Ô¸ÉɬËûÈËÕ½¶·£¬±»²ÃÅдø×ßÁË£¬¹ØÓÚ³ÂëÀûµÄ´¦·ÖÔÚµÚÈý¼¯Ò²ÒѾ­¸ø³ö´ð°¸¡£ÄDZãÊÇÈóÂëÀûºÍ²Ã...

³±¡¤¿Æ¼¼

Ò»¼ÓNordn10 5gºÍ100¼´½«·¢²¼£¬ÖеͶËÊÖ»ú£¿

ÔĶÁ(30)

ÆäʵÏÖÔÚÄܹ»¿´³öÀ´µÄÒ»¼þÊ £¬ Ò»¼ÓÏÖÔÚÒ²¿ªÊ¼Öð½¥Ôö¼Ó×Ô¼ºµÄ²úÆ·ÊýÁ¿ £¬ µ±È»¾ÍÊÇ˵ÏÖÔÚ²»¹âÊÇרÃÅ×öÆì½¢ÊÖ»úÁË £¬ µ±È» £¬ ÕâÊÇÒ»¸öËãÊDZ»¶¯µÄ¸Ä±ä £¬ Ò»¼Ó¿´ÆðÀ´Òª·¢²¼ÐÂÆ·ÁË...