spug icon indicating copy to clipboard operation
spug copied to clipboard

请问下最新版本支持导出所有主机列表了吗?

Open feixia5712 opened this issue 3 years ago • 3 comments

请问下最新版本支持导出所有主机列表了吗?

feixia5712 avatar Nov 17 '22 08:11 feixia5712

4.x 版本已经支持。 参考一下这里:https://github.com/openspug/spug/issues/535

zyupo avatar Dec 06 '22 09:12 zyupo

稳定版本目前还没推出来吧

feixia5712 avatar Dec 07 '22 03:12 feixia5712

可以使用mysql命令导出,调整下SQL就行。 --进入数据库 docker exec -it spug-db mysql -uroot -pspug.cc1 spug --设置字符集 set character_set_results=utf8; --查询组对应ID,取sort_id值 select * from host_groups; --根据组sort_id,查询组内主机 select * from hosts where id in (select host_id from host_groups_hosts where group_id=74 );

select * from hosts where id in (select host_id from host_groups_hosts where group_id=68 ); --导出数据 docker exec -it spug-db mysql -uroot -ppassword spug -e "SELECT hostname,port,name FROM hosts WHERE id IN (SELECT host_id FROM host_groups_hosts WHERE group_id IN (75, 76, 65));" > idc.txt

--备份数据 docker exec spug-db sh -c 'exec mysqldump spug -uroot -p"password"' > spug_$(date +"%Y_%m_%d")_spug_backup.sql

EvanderYang avatar Mar 20 '24 09:03 EvanderYang