【实战】Splunk SearchHead Cluster部署
1 设置SHC Deployer角色
编辑Deployer节点上的$SPLUNK_HOME/etc/local/system/server.conf配置文件,添加下述配置内容:
1 2 3
| [shclustering] pass4SymmKey = shc shcluster_label = shc
|
重启Deployer节点Splunk服务
1
| $SPLUNK_HOME/bin/splunk restart
|
2 搭建SearchHead Cluster
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| /opt/splunk/bin/splunk init shcluster-config -auth admin:admin@123 -mgmt_uri https://[SH01]:8089 -replication_port 8292 -replication_factor 3 -conf_deploy_fetch_url https://[Deployer]:8089 -secret shc -shcluster_label shc
/opt/splunk/bin/splunk init shcluster-config -auth admin:admin@123 -mgmt_uri https://[SH02]:8089 -replication_port 8292 -replication_factor 3 -conf_deploy_fetch_url https://[Deployer]:8089 -secret shc -shcluster_label shc
/opt/splunk/bin/splunk init shcluster-config -auth admin:admin@123 -mgmt_uri https://[SH03]:8089 -replication_port 8292 -replication_factor 3 -conf_deploy_fetch_url https://[Deployer]:8089 -secret shc -shcluster_label shc
/opt/splunk/bin/splunk restart
/opt/splunk/bin/splunk bootstrap shcluster-captain -servers_list "https://[SH01]:8089,https://[SH02]:8089,https://[SH03]:8089" -auth admin:admin@123
|
3 Deployer节点推送给SearchHead ClusterApps
1 2
| /opt/splunk/bin/splunk apply shcluster-bundle --answer-yes -target https://[SH01]:8089 -auth admin:admin@123
|
4 补充:SearchHead Cluster添加新的节点
4.1 初始化SearchHead节点
1 2 3 4
| /opt/splunk/bin/splunk init shcluster-config -auth admin:admin@123 -mgmt_uri https://[SH04]:8089 -replication_port 8292 -replication_factor 3 -conf_deploy_fetch_url https://[Deployer]:8089 -secret shc -shcluster_label SHC-Test
/opt/splunk/bin/splunk init shcluster-config -auth admin:admin@123 -mgmt_uri https://[SH05]:8089 -replication_port 8292 -replication_factor 3 -conf_deploy_fetch_url https://[Deployer]:8089 -secret shc -shcluster_label SHC-Test
|
4.2 新SearchHead节点添加到SearchHead Cluster
1 2 3 4 5 6 7 8 9 10 11 12
|
/opt/splunk/bin/splunk add shcluster-member -current_member_uri https://[SH01]:8089 -auth admin:admin@123
/opt/splunk/bin/splunk add shcluster-member -new_member_uri https://[SH05]:8089 -auth admin:admin@123 /opt/splunk/bin/splunk add shcluster-member -new_member_uri https://[SH06]:8089 -auth admin:admin@123
/opt/splunk/bin/splunk show shcluster-status
|
4.3 回退方式
1 2 3 4 5 6 7 8 9 10 11
| /opt/splunk/bin/splunk remove shcluster-member
/opt/splunk/bin/splunk disable shcluster-config
/opt/splunk/bin/splunk stop
/opt/splunk/bin/splunk clean kvstore --cluster
|
参考文档:https://docs.splunk.com/Documentation/Splunk/9.0.0/DistSearch/Addaclustermember#Initialize_the_instance
参考文档:https://docs.splunk.com/Documentation/Splunk/9.0.0/DistSearch/Removeaclustermember