Ralf_dev for Zinst
[:: zinst - Linux System Package화 관리도구 ::] 본문
Zinst
Linux server system 패키지화 관리도구. - (Yahoo!의 System 관리도구 yinst를 Concept으로 함)
- Link: zinst packages based management tool in github
- Link: zinst packages repository in github
- 문의는 email을 통해서 언제든지 가능 합니다. :)
- Contact: goody80762@gmail.com or ralf.yang@gsshop.com
- 초기 설치를 위한 Package구성은 해당 Link를 통해서 가능 합니다. - Download Starters package file on dropox.com
요약
zinst는 일련의 file 및 설정, schedule등을 일괄 적용 하고, multi-host로 배포 가능한 System관리 Total solution 입니다.
복수개의 서버로 패키지 원격 설치방법
ex) zinst install apache_server-1.0.1.zinst apache_conf-1.0.1.zinst -h web0[1-7,9]
- 위와같이 일부 정규표현식을 통한 범위 지정이 가능 합니다.
- 예를들어 web0[10-13,15] 이라고 표기 할 경우 web010, web011, web012, web013, web015 으로 인식 하고 적용이 진행 됩니다.
설치된 Package에 대한 내역을 확인 할 수 있습니다.
ex) zinst list or zinst ls
]$ zinst ls
2014-02-13 09:44:41 - cloudstack_dashboard-0.1.8
2013-10-10 10:02:39 - gs_source_backup_full-1.0.0
2013-11-29 17:55:44 - gsshop_account_policy-1.0.4
2013-11-29 17:56:09 - gsshop_authorize_client-1.0.1
2013-10-22 15:26:05 - gsshop_cdn_cache_controller-1.0.0
2014-01-24 18:32:32 - gsshop_hosts_file_mc-0.0.1
2014-01-24 18:32:23 - gsshop_hosts_file_xen-0.0.1
2014-02-12 20:06:55 - gsshop_httpd_conf_pkgdist-1.0.1
2014-02-12 20:06:43 - gsshop_httpd_server-2.0.2
2014-01-16 23:13:44 - gsshop_snmpd-0.1.0
2014-02-11 16:53:05 - gsshop_tomcat-1.0.2
2014-02-11 16:59:20 - gsshop_tomcat_conf_mc_test-0.0.1
2013-12-24 11:11:08 - gsshop_tomcat_jdk-1.6.37
2014-02-11 16:59:44 - gsshop_tomcat_mc_test_frontmember-0.0.1
2014-01-24 18:32:23 - hosts_file_creator-0.0.1
2014-02-11 16:35:49 - hwconfig-1.3.1
2014-01-16 23:13:45 - opsview_agent-0.1.4
2013-10-22 15:46:28 - package_tracker-1.0.3
2014-01-23 14:01:38 - python_virtualenv-0.1.0
2013-10-10 10:09:40 - rzsz-0.1.2
2013-11-29 17:54:47 - server_default_setting-1.2.6
2013-10-30 14:24:11 - ssh_consolebox-0.1.0
2013-10-28 15:42:00 - sshkey_deploy-1.0.1
2013-10-10 11:29:44 - sshpass-1.0.5
2014-02-11 11:50:07 - telnet-0.1.7
2014-02-04 17:24:21 - user_account_creator-0.0.1
2014-02-13 11:19:43 - user_hwlee-0.0.1
2014-02-11 17:41:04 - vipctl-1.0.5
2013-10-18 17:19:57 - ysar-1.0.8
2014-01-27 09:41:17 - yum_downloadonly-1.1.3
2014-02-04 17:24:34 - zinst_making_tool-1.2.0
패키지 설치 방법
- 버젼명이 명시된 package명으로 설치 가능하며, 버젼명이 없이 최신 package를 적용 하고자 할 때 -stable option으로 설치 가능 합니다.
]$ zinst install hwconfig-1.0.3.zinst
or
]$ zinst install hwconfig -stable
특정 패키지가 구성하고 있는 file의 내역을 확인 할 수 있습니다.
ex) zinst ls -files hwconfig
- apache_server 라는 package에 대한 file 내역을 보여 줍니다.
]$ zinst ls -files hwconfig
/data/bin/MegaCli
/data/bin/sas2ircu
/data/bin/lspci
/data/var/checklist.txt
/data/var/hwconfig.list
/data/var/dmidecode.list
/data/bin/hwconfig
특정 file이 어떤 Package를 통해 적용 되었는지 쉽게 확인이 가능 합니다.
]$ zinst ls -files /data/bin/hwconfig
hwconfig-1.3.1 <------- /data/bin/hwconfig
$] zinst history
2014.02.13_09:39:05 ralf.yang : + Install - cloudstack_dashboard-0.1.8 -same
2014.02.13_09:39:16 ralf.yang : * setup - cloudstack_dashboard.account=ralf.yang
2014.02.13_11:19:44 ralf.yang : + Install - user_hwlee-0.0.1
2014.02.13_11:41:30 ralf.yang : * setup - cloudstack_dashboard.account=devel
2014.02.13_16:13:10 canopus : # Daemon restart - httpd
canopus : # - Daemon Working: [ OK ]
2014.02.13_16:13:28 canopus : # Daemon restart - httpd
canopus : # - Daemon Working: [ OK ]
Package에 포함된 전체 setting값을 한번에 조회 할 수 있습니다.
]$ zinst set
gsshop_httpd_server.Dir=/data
gs_source_backup_full.BACKDIR=/data/dist/
package_tracker.RotateCycle=30
server_default_setting.name1=8..8.8.8
server_default_setting.name2=5.5.5.5
gsshop_authorize_client.LDAPserver=10.10.10.100
gsshop_authorize_client.BaseDN="dc=iceberg,dc=gs"
hwconfig.nameserver1=8.8.8.8
hwconfig.nameserver2=5.5.5.5
gsshop_tomcat_conf_mc_test.Heapsize=1g
gsshop_tomcat_conf_mc_test.MaxHeapsize=2g
gsshop_tomcat_conf_mc_test.NewSize=256m
gsshop_tomcat_conf_mc_test.MaxNewSize=512m
gsshop_tomcat_conf_mc_test.PermSize=128m
gsshop_tomcat_conf_mc_test.MaxPermSize=256m
gsshop_tomcat_conf_mc_test.SurvivorRatio=6
gsshop_tomcat_conf_mc_test.ParallelGCThreads=4
gsshop_tomcat_conf_mc_test.MaxTenuringThreshold=15
gsshop_tomcat_conf_mc_test.MaxGCPauseMillis=1000
gsshop_tomcat_conf_mc_test.JAVA_OPT_ENV=test,monitoring
gsshop_tomcat_conf_mc_test.JmxRemote_Port=20006
gsshop_tomcat_conf_mc_test.Instance_Config=/data/bin/gsshop_tomcat_instance_mgmt.sh
gsshop_tomcat_mc_test_frontmember.Context=front-member
gsshop_tomcat_mc_test_frontmember.Domain=member01.test.test.com
gsshop_tomcat_mc_test_frontmember.HTTP_Port=10001
gsshop_tomcat_mc_test_frontmember.MaxThreds=1024
vipctl.onboot=yes
vipctl.DIR=/data/src/html
vipctl.Check_file=l4-check.html
vipctl.name=ddd
vipctl.vips=10.10.10.10
- 변경전
]$ zinst set |grep gsshop_tomcat_conf_mc_test.Heapsize
gsshop_tomcat_conf_mc_test.Heapsize=1g
- 변경 적용
]$ zinst set gsshop_tomcat_conf_mc_test.Heapsize=2g
gsshop_tomcat_conf_mc_test.Heapsize=2g
- 변경 후
]$ zinst set |grep gsshop_tomcat_conf_mc_test.Heapsize
gsshop_tomcat_conf_mc_test.Heapsize=2g
]$ cat /data/z/applications/tomcat/bin/setenv.sh
hostname=`hostname`
CATALINA_LOGS=/xxx/tomcat/logs
Heapsize=2g
MaxHeapsize=2g
NewSize=256m
MaxNewSize=512m
ssh command와 -h option을 통해서 다수의 원격지 장비로 command를 보내어 실행 할 수 있습니다.
]$ zinst ssh "whoami" -h web[0-1][0-9], web20
원격지 장비에 대한 Hosts list를 제작 후 적용에 사용 할 수 있습니다. 이 때는 -H option을 사용 합니다.
]$ cat./hostlist.txt
web[0-1][0-9]
web20
10.0.0.2
10.0.0.8
]$ zinst ssh "whoami" -H ./hostlist.txt
]$ zinst remove httpd_server httpd_server_conf_dev -h web[0-1][0-9], web20
하나의 Package를 통해서 다수의 다른 설정의 Server 구성이 가능 합니다.
]$ zinst install apache_server -set apache_server.maxclient=32 -h web01 web02
]$ zinst install apache_server -set apache_server.maxclient=64 -h news01 news02
Service Daemon에 대한 Control이 가능 하며, 처리 내역을 history를 통해 확인 가능 합니다.
]$ zinst start httpd
- service httpd start 와 같은 명령이 실행 됩니다.
지금까지 설치 된 package와 대상 server의 내역을 한번에 쉽게 확인 할 수 있습니다.
$] zinst track telnet-0.1.7.zinst
Package has been released to below list - Sort by "telnet-0.1.7.zinst"
===================================================================
Host Package Date
===================================================================
10.0.1.31 telnet-0.1.7.zinst [27/Dec/2013:13:38:25]
10.0.1.4 telnet-0.1.7.zinst [11/Feb/2014:11:50:07]
10.0.1.34 telnet-0.1.7.zinst [11/Feb/2014:15:20:24]
10.0.1.3 telnet-0.1.7.zinst [12/Feb/2014:19:12:27]
===================================================================
zinst는 현재 적용 되어져 있는 패키지 구성 및 setting값을 save 파일로 보관 하고 있습니다. 저장된 save 파일을 통해서 해당 시점으로 package및 setting을 전체 roll-back 처리 할 수 있습니다.
]$ zinst restore -file /data/z/save/zinst-save.56
Bash script 언어로 제작 되어서, Code 확인이 직관적이며 수정이 용이 합니다.
또한 Bash를 사용하는 대부분의 System에 별도의 설정 추가/변경 없이 사용 가능 합니다.
초기 설치 방법
초기 설치 파일(install.sh)를 통해 한번 설정이 되고 나면, 원격지로 작업 요청시 자동으로 zinst 명령어가 복제되어 사용 가능하게 됩니다.
]$ sh ./install.sh
========================================================================================
Please insert directory name for you want (ex /data )
Directory will be created as you type it
========================================================================================
/data
========================================================================================
Do you want to make a Distribute server for packages download? [y / n ]
* Notice: Apache web server will be start in this server automaticlly *
========================================================================================
y
=======================================================================================
File directory for the Distritution is /data/dist
=======================================================================================
========================================================================================
Please insert your Domain name of the Distribution server ex)package.dist.blahblah.com
========================================================================================
package.dist.blahblah.com
=======================================================================================
Please insert your IP address of the Distribution server
=======================================================================================
10.0.0.11
=======================
| Go ahead ? [y or n] |
=======================
설치가 완료 된 후, 재접속
사용방법
$] zinst -help
------------------------------------------------------------------------------------------------------ zinst [Command] [Option Types] [Target Names] [-h or -H] [Targe Host] ------------------------------------------------------------------------------------------------------ + For remote work - Remote control: You can send a command to seperated hosts ssh [Command] *Host requires ...................................................................................................... - File copy to remote: You can send a file(s) to seperated hosts(mcp = Multi CoPier) mcp [local-files] [Destination DIR] *Host requires ------------------------------------------------------------------------------------------------------ + For Package - Package manage: You can install/remove a package as under the command install [Package] [-same] [Package] [-downgrade] [Package] [-stable] [Package without version for latest package] remove [Package] [-force] [Package] ...................................................................................................... - Package view: You can see an installed packages/files/index & dependency list [Blank for list-up] [-files] [Package] [-files] [/Dir/File-name] [-zicf] [Package] [-dep] [Package] ...................................................................................................... - Package restore: You can restore the package set as a file for restore ex) ~/z/save/zinst-* restore [-file] [Saved file_name] [-igor] * Not available yet ------------------------------------------------------------------------------------------------------ + For Configuration - Configuration: Zinst can helps to configure the setup without manual modify the Conf-file set [Blank for list-up] [Package.option=value] - Configuration with Install: Configure the setup with the package install [Package] -set [Package.option=value] ------------------------------------------------------------------------------------------------------ + For System manage - Daemon control: You can control the daemon from the /etc/init.d/ directory start [Daemon_name] stop [Daemon_name] restart [Daemon_name] ...................................................................................................... - Crontab manage: You can touch the cron schduler by zinst crontab [-e] [-l] ------------------------------------------------------------------------------------------------------ + For install available package find - Package find find [Blank for list-up] [Package] ------------------------------------------------------------------------------------------------------ + For tracking the released package - Track the package track [Blank for list-up] [Package or hostname] [Package or hostname] [-file] [Package or hostname] [-file] [Export File_name] ------------------------------------------------------------------------------------------------------ + View history history [Number of Range] ...................................................................................................... -pass Option for Multi-host password automation self-update -version *, help ------------------------------------------------------------------------------------------------------ -h is target host, -H is targe file of hostlist ex) zinst i sample-1.0.0.zinst -h web01.news.kr[1,3] web[03-12].news[1,3] ex) zinst i sample-1.0.0.zinst -H ./server_list.txt ------------------------------------------------------------------------------------------------------ Example) zinst ssh 'cat /etc/hosts;pwd' -h web[01-09].test.com : Send a command to seperated hosts zinst mcp ./test.* /data/var/ -h web[01-09].test.com : File copy to seperated hosts zinst install hwconfig -stable : for package apply as a latest version automatically zinst install hwconfig-1.0.2.zinst -same : for overwrite the package as a same version zinst i hwconfig-1.0.2.zinst -downgrade : for downgrade the package as a lower version zinst list -files hwconfig : list-up file of the hwconfig package zinst ls -files /data/bin/hwconfig : find a package as a file zinst list -zicf hwconfig : see the index file of package zinst ls -dep hwconfig : package dependency check zinst set : list-up of zinst current setups zinst set hwconfig.nameserver1=1.1.1.1 : change the setup nameserver1=1.1.1.1 to the hwconfig zinst i hwconfig-1.0.2.zinst -set hwconfig.nameserver1=1.1.1.1 -set hwconfig.nameserver2=2.2.2.2 : change the setup nameserver1=1.1.1.1 and nameserver2=2.2.2.2 to the hwconfig with package install zinst restart httpd : restart the httpd daemon by /etc/init.d/httpd file control zinst crontab -l : list-up the crontab scheduler zinst crontab -u root -l : list-up the crontab scheduler for an user zinst cront -e : edit the crontab scheduler zinst find : list-up the available file for install zinst find hwcon : list-up the available file for install as you typed zinst hist : show the history zinst hist 300 : show the 300 lines history zinst self-update : zinst command update( *Requires: Package dist server must has a zinst file) zinst help : Detail view the help === For more detail: http://twiki.gsenext.com/bin/view/Main/TheZinst ===