基础版本
This commit is contained in:
18
.idea/Galaxy-auto-deploy-cluster-21.07.iml
generated
Normal file
18
.idea/Galaxy-auto-deploy-cluster-21.07.iml
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/parcels/roles/init/druid/templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
||||
</component>
|
||||
</module>
|
||||
4
.idea/encodings.xml
generated
Normal file
4
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||
</project>
|
||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (python3.7)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Galaxy-auto-deploy-cluster-21.07.iml" filepath="$PROJECT_DIR$/.idea/Galaxy-auto-deploy-cluster-21.07.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
102
.idea/workspace.xml
generated
Normal file
102
.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="55c8c5b9-9b57-431e-a0ed-0064b85979fa" name="Default Changelist" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="ROOT_SYNC" value="DONT_SYNC" />
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6" fullScreen="true">
|
||||
<option name="width" value="2560" />
|
||||
<option name="height" value="1440" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Galaxy-auto-deploy-cluster-21.07" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="Galaxy-auto-deploy-cluster-21.07" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="55c8c5b9-9b57-431e-a0ed-0064b85979fa" name="Default Changelist" comment="" />
|
||||
<created>1629364019161</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1629364019161</updated>
|
||||
<workItem from="1629364020595" duration="323000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="323000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="0" width="2560" height="1440" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24980143" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Database Changes" />
|
||||
<window_info anchor="bottom" id="Version Control" />
|
||||
<window_info anchor="bottom" id="Python Console" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="SciView" />
|
||||
<window_info anchor="right" id="Database" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
</project>
|
||||
79
README.md
Normal file
79
README.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# 使用手册
|
||||
|
||||
[TOC]
|
||||
|
||||
## 目录结构
|
||||
Galaxy-auto-deploy-cluster-21.07
|
||||
├── inventories
|
||||
│ └── pro
|
||||
│ ├── group_vars
|
||||
│ └── hosts
|
||||
├── parcels
|
||||
│ ├── menu
|
||||
│ │ ├── appMenu
|
||||
│ │ ├── commonMenu
|
||||
│ │ └── homePage
|
||||
│ ├── roles
|
||||
│ │ ├── check
|
||||
│ │ ├── components
|
||||
│ │ ├── dependencies
|
||||
│ │ ├── init
|
||||
│ │ └── services
|
||||
│ ├── Arangodb.yml
|
||||
│ ├── check-components.yml
|
||||
│ ├── check-services.yml
|
||||
│ ├── Clickhouse.yml
|
||||
│ ├── Druid.yml
|
||||
│ ├── environment.yml
|
||||
│ ├── galaxy-chproxy.yml
|
||||
│ ├── galaxy-gateway-keepalive.yml
|
||||
│ ├── galaxy-gateway-nginx.yml
|
||||
│ ├── galaxy-gohangout.yml
|
||||
│ ├── galaxy-hos-keepalive.yml
|
||||
│ ├── galaxy-hos-nginx.yml
|
||||
│ ├── galaxy-hos-service.yml
|
||||
│ ├── galaxy-job-service.yml
|
||||
│ ├── galaxy-qgw-service.yml
|
||||
│ ├── galaxy-report-service.yml
|
||||
│ ├── Hadoop.yml
|
||||
│ ├── HBase.yml
|
||||
│ ├── init-clickhouse.yml
|
||||
│ ├── init-druid.yml
|
||||
│ ├── init-galaxy-gateway-keepalive.yml
|
||||
│ ├── init-galaxy-hos-service.yml
|
||||
│ ├── init-galaxy-job-service.yml
|
||||
│ ├── init-hbase.yml
|
||||
│ ├── init-kafka.yml
|
||||
│ ├── init-spark.yml
|
||||
│ ├── init-storm.yml
|
||||
│ ├── Kafka.yml
|
||||
│ ├── Mariadb.yml
|
||||
│ ├── Nacos.yml
|
||||
│ ├── Spark.yml
|
||||
│ ├── Storm.yml
|
||||
│ ├── test1.yml
|
||||
│ ├── test.yml
|
||||
│ └── Zookeeper.yml
|
||||
├── software_packages
|
||||
|
||||
|
||||
## 纪要
|
||||
- 主机ip配置文件
|
||||
inventories/pro/hosts
|
||||
|
||||
- 所有role(主机)使用的变量
|
||||
inventories/pro/group_vars/all
|
||||
新开发的role的变量可定义到此文件中统一管理, 已存在的role的变量直接修改此文件即可
|
||||
`注意`: 新增变量名不可与已有变量发生重复
|
||||
|
||||
- 部署包目录
|
||||
software_packages
|
||||
为方便管理, 将相关部署包和镜像移到software_packages文件夹下(避免大文件上传gitlab)
|
||||
|
||||
|
||||
## 使用说明
|
||||
1. 配置 inventories/pro/hosts 部署组件的主机
|
||||
|
||||
2. 视情况修改 inventories/pro/group_vars/all 里的相关配置
|
||||
|
||||
3. 确实好配置后执行 "sh install.sh" 进行安装
|
||||
666
install.sh
Executable file
666
install.sh
Executable file
@@ -0,0 +1,666 @@
|
||||
#!/bin/bash
|
||||
|
||||
NUM_DIR="/usr/galaxyinstmp"
|
||||
if [ ! -d "$NUM_DIR/" ];then
|
||||
mkdir -p $NUM_DIR/
|
||||
fi
|
||||
|
||||
cd parcels
|
||||
|
||||
function checkManager() {
|
||||
echo "Check whether the current executor has Docker and Ansible environment, if not, install it"
|
||||
echo -e "\033[31;1mThe process may prompt command not found error, please ignore it.\033[0m"
|
||||
|
||||
sleep 2
|
||||
a=`docker -v`
|
||||
hasDocker=$?
|
||||
if [[ $hasDocker != '0' ]]; then
|
||||
echo "
|
||||
"
|
||||
echo -e "\033[31;1mThis Docker not installed, Please install\033[0m"
|
||||
exit 1
|
||||
else
|
||||
echo "
|
||||
"
|
||||
echo -e "\033[32;1mThis Docker installed, the version is:\033[0m"
|
||||
docker -v
|
||||
|
||||
fi
|
||||
|
||||
a=`ansible --version`
|
||||
hasAnsible=$?
|
||||
if [[ $hasAnsible != '0' ]]; then
|
||||
echo "
|
||||
"
|
||||
echo -e "\033[31;1mThis Ansible not installed, Please install\033[0m"
|
||||
exit 1
|
||||
else
|
||||
echo "
|
||||
"
|
||||
echo -e "\033[32;1mThis Ansible installed, the version is:\033[0m"
|
||||
ansible --version
|
||||
echo 1 > $NUM_DIR/checkManager
|
||||
fi
|
||||
sleep 5
|
||||
}
|
||||
|
||||
|
||||
function checkCluster() {
|
||||
clear
|
||||
echo "Check the environment to be deployed, including JDK, PIP, Docker, Firewall, TimeZone if not installed"
|
||||
sleep 2
|
||||
ansible-playbook -i ../inventories/pro/hosts environment.yml
|
||||
if [ $? -eq '0' ];then
|
||||
clear
|
||||
echo -e "\033[32;1mEnvironmental check complete, ready for installation\033[0m"
|
||||
sleep 5
|
||||
echo 1 > $NUM_DIR/checkCluster
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#记录组件安装次数
|
||||
function recordinstnum() {
|
||||
FILE_NAME=$1
|
||||
|
||||
if [ -f "$NUM_DIR/$FILE_NAME" ];then
|
||||
OLD_NUM=`cat $NUM_DIR/$FILE_NAME`
|
||||
INS_NUM=`expr $OLD_NUM + 1`
|
||||
echo $INS_NUM > $NUM_DIR/$FILE_NAME
|
||||
else
|
||||
echo 1 > $NUM_DIR/$FILE_NAME
|
||||
fi
|
||||
}
|
||||
|
||||
#获取组件安装次数
|
||||
function getrecordnum() {
|
||||
FILE_NAME=$1
|
||||
|
||||
if [ ! -d "$NUM_DIR/" ];then
|
||||
mkdir -p $NUM_DIR/
|
||||
fi
|
||||
|
||||
if [ -f "$NUM_DIR/$FILE_NAME" ];then
|
||||
echo `cat $NUM_DIR/$FILE_NAME`
|
||||
else
|
||||
echo 0 > $NUM_DIR/$FILE_NAME
|
||||
echo 0
|
||||
fi
|
||||
}
|
||||
|
||||
#输出组件安装信息
|
||||
function echoSuccess() {
|
||||
NAME=$1
|
||||
|
||||
echo -e "
|
||||
\033[32;1m$NAME Components have been installed.\033[0m
|
||||
"
|
||||
echo "`date "+%Y-%m-%d %H:%M:%S"` - $NAME 剧本已执行完成." >> ../auditlog
|
||||
sleep 5
|
||||
clear
|
||||
}
|
||||
|
||||
#输出组件安装信息
|
||||
function echoError() {
|
||||
NAME=$1
|
||||
|
||||
echo -e "\033[31;1m $NAME The installation fails. Please check\033[0m"
|
||||
echo "`date "+%Y-%m-%d %H:%M:%S"` - $NAME 剧本执行异常." >> ../auditlog
|
||||
sleep 5
|
||||
}
|
||||
|
||||
#=========================================commons======================================#
|
||||
#单个安装执行方法,根据传入的组件名称进行安装
|
||||
#若安装出现异常导致ansible停止,则脚本直接终止
|
||||
#若本机多次安装过某组件,则会提示是否继续安装;y 继续 N 停止
|
||||
function installation() {
|
||||
NAME=$1
|
||||
|
||||
is=`getrecordnum $NAME`
|
||||
if [ $is -lt '1' ];then
|
||||
ansible-playbook -i ../inventories/pro/hosts $NAME.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $NAME
|
||||
recordinstnum $NAME
|
||||
else
|
||||
echoError $NAME
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
clear && echo -e "\033[31;1m本执行机已成功安装过 $is 次$NAME,缺是否继续安装,误操作可根据提示返回 \033[0m" && sleep 1
|
||||
while true; do
|
||||
read -p "y/Y 继续执行安装,n/N 返回选择菜单:" yn
|
||||
case $yn in
|
||||
[Yy]*)
|
||||
ansible-playbook -i ../inventories/pro/hosts $NAME.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $NAME
|
||||
recordinstnum $NAME
|
||||
break
|
||||
else
|
||||
echoError $NAME
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
[Nn]*)
|
||||
break;;
|
||||
* )
|
||||
echo "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#组合安装正常逻辑,逐个组件询问,Y执行 N不执行安装。
|
||||
#记录数组通过循环顺序执行安装
|
||||
function installAllCommon() {
|
||||
clear
|
||||
|
||||
i=0
|
||||
ins_names=(Zookeeper Mariadb galaxy-gateway-keepalive Nacos Kafka Storm Hadoop HBase Clickhouse Druid Spark Arangodb)
|
||||
echo ${ins_names[@]} > $NUM_DIR/common_list
|
||||
|
||||
#根据组合进行顺序安装
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
recordinstnum $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
echo ${ins_names[@]} > $NUM_DIR/common_list
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#组合安装异常终止执行操作
|
||||
#询问是否需要再上次基础上执行,否则清空文件跳出循环
|
||||
function abnormalCombination() {
|
||||
clear
|
||||
while true; do
|
||||
echo -e "
|
||||
\033[31;1m上次选择部署后还有 `cat $NUM_DIR/common_list`未执行部署,是否继续执行.\033[0m
|
||||
"
|
||||
read -p "y/Y 继续执行安装,n/N 返回选择菜单:" yn
|
||||
case $yn in
|
||||
[Yy]*)
|
||||
i=0
|
||||
#根据组合进行顺序安装
|
||||
list=`cat $NUM_DIR/common_list`
|
||||
ins_names=(${list//,/ })
|
||||
oldnums=${#ins_names[*]}
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
recordinstnum $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
if [ $i -eq $oldnums ];then
|
||||
cat /dev/null > $NUM_DIR/common_list
|
||||
else
|
||||
echo ${ins_names[@]} > $NUM_DIR/common_list
|
||||
fi
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
break
|
||||
;;
|
||||
[Nn]*)
|
||||
cat /dev/null > $NUM_DIR/common_list
|
||||
break;;
|
||||
* )
|
||||
echo "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
#组合安装调用方法
|
||||
function installcombination() {
|
||||
|
||||
if [ -f $NUM_DIR/common_list ];then
|
||||
if [ `cat $NUM_DIR/common_list | egrep "Mariadb|Nacos|Zookeeper|galaxy-gateway-keepalive|Kafka|Storm|Hadoop|HBase|Clickhouse|Druid|Spark|Arangodb" | wc -l` -gt '0' ]
|
||||
then
|
||||
abnormalCombination
|
||||
else
|
||||
installAllCommon
|
||||
fi
|
||||
else
|
||||
installAllCommon
|
||||
fi
|
||||
clear
|
||||
}
|
||||
#=========================================commons======================================#
|
||||
|
||||
#=========================================apps======================================#
|
||||
#单个安装执行方法,根据传入的组件名称进行安装
|
||||
#若安装出现异常导致ansible停止,则脚本直接终止
|
||||
#若本机多次安装过某组件,则会提示是否继续安装;y 继续 N 停止
|
||||
function installationApps() {
|
||||
NAME=$1
|
||||
|
||||
is=`getrecordnum $NAME`
|
||||
if [ $is -lt '1' ];then
|
||||
ansible-playbook -i ../inventories/pro/hosts $NAME.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $NAME
|
||||
recordinstnum $NAME
|
||||
else
|
||||
echoError $NAME
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
clear && echo -e "\033[31;1m本执行机已成功安装过 $is 次$NAME,缺是否继续安装,误操作可根据提示返回 \033[0m" && sleep 1
|
||||
while true; do
|
||||
read -p "y/Y 继续执行安装,n/N 返回选择菜单:" yn
|
||||
case $yn in
|
||||
[Yy]*)
|
||||
ansible-playbook -i ../inventories/pro/hosts $NAME.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $NAME
|
||||
recordinstnum $NAME
|
||||
break
|
||||
else
|
||||
echoError $NAME
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
[Nn]*)
|
||||
break;;
|
||||
* )
|
||||
echo "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#组合安装正常逻辑,逐个组件询问,Y执行 N不执行安装。
|
||||
#记录数组通过循环顺序执行安装
|
||||
function installAllApps() {
|
||||
clear
|
||||
|
||||
i=0
|
||||
hoskeep=`cat ../inventories/pro/config.yml | grep "hos_keepalive_need: yes" | wc -l`
|
||||
if [[ $hoskeep -eq "1" ]]; then
|
||||
ins_names=(galaxy-gateway-nginx galaxy-qgw-service galaxy-job-service galaxy-report-service galaxy-hos-service galaxy-chproxy galaxy-hos-nginx galaxy-hos-keepalive galaxy-gohangout)
|
||||
else
|
||||
ins_names=(galaxy-gateway-nginx galaxy-qgw-service galaxy-job-service galaxy-report-service galaxy-hos-service galaxy-chproxy galaxy-gohangout)
|
||||
fi
|
||||
echo ${ins_names[@]} > $NUM_DIR/app_list
|
||||
|
||||
#根据组合进行顺序安装
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
recordinstnum $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
echo ${ins_names[@]} > $NUM_DIR/app_list
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#组合安装异常终止执行操作
|
||||
#询问是否需要再上次基础上执行,否则清空文件跳出循环
|
||||
function abnormalApps() {
|
||||
clear
|
||||
while true; do
|
||||
echo -e "
|
||||
\033[31;1m上次选择部署后还有 `cat $NUM_DIR/app_list`未执行部署,是否继续执行.\033[0m
|
||||
"
|
||||
read -p "y/Y 继续执行安装,n/N 返回选择菜单:" yn
|
||||
case $yn in
|
||||
[Yy]*)
|
||||
i=0
|
||||
#根据组合进行顺序安装
|
||||
list=`cat $NUM_DIR/app_list`
|
||||
ins_names=(${list//,/ })
|
||||
oldnums=${#ins_names[*]}
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
recordinstnum $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
if [ $i -eq $oldnums ];then
|
||||
cat /dev/null > $NUM_DIR/app_list
|
||||
else
|
||||
echo ${ins_names[@]} > $NUM_DIR/app_list
|
||||
fi
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
break;;
|
||||
[Nn]*)
|
||||
cat /dev/null > $NUM_DIR/app_list
|
||||
break;;
|
||||
* )
|
||||
echo "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
#组合安装调用方法
|
||||
function installApps() {
|
||||
|
||||
if [ -f $NUM_DIR/app_list ];then
|
||||
if [ `cat $NUM_DIR/app_list | egrep "galaxy-qgw-service|galaxy-job-service|galaxy-report-service|galaxy-hos-service|galaxy-chproxy|galaxy-gateway-nginx|galaxy-hos-nginx|galaxy-hos-keepalive|galaxy-gohangout" | wc -l` -gt '0' ]
|
||||
then
|
||||
abnormalApps
|
||||
else
|
||||
installAllApps
|
||||
fi
|
||||
else
|
||||
installAllApps
|
||||
fi
|
||||
clear
|
||||
}
|
||||
|
||||
#======================================apps======================================#
|
||||
|
||||
#======================================init======================================#
|
||||
#组合安装正常逻辑,逐个组件询问,Y执行 N不执行安装。
|
||||
#记录数组通过循环顺序执行安装
|
||||
function initAll() {
|
||||
clear
|
||||
|
||||
i=0
|
||||
ins_names=(init-galaxy-gateway-keepalive init-kafka init-hbase init-druid init-clickhouse init-storm init-spark init-galaxy-hos-service)
|
||||
echo ${ins_names[@]} > $NUM_DIR/init_list
|
||||
|
||||
#根据组合进行顺序安装
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
echo ${ins_names[@]} > $NUM_DIR/init_list
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
#组合安装异常终止执行操作
|
||||
#询问是否需要再上次基础上执行,否则清空文件跳出循环
|
||||
function abnormalInit() {
|
||||
clear
|
||||
while true; do
|
||||
echo -e "
|
||||
\033[31;1m上次选择部署后还有 `cat $NUM_DIR/init_list`未执行部署,是否继续执行.\033[0m
|
||||
"
|
||||
read -p "y/Y 继续执行安装,n/N 返回选择菜单:" yn
|
||||
case $yn in
|
||||
[Yy]*)
|
||||
i=0
|
||||
#根据组合进行顺序安装
|
||||
list=`cat $NUM_DIR/init_list`
|
||||
ins_names=(${list//,/ })
|
||||
oldnums=${#ins_names[*]}
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
recordinstnum $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
if [ $i -eq $oldnums ];then
|
||||
cat /dev/null > $NUM_DIR/init_list
|
||||
else
|
||||
echo ${ins_names[@]} > $NUM_DIR/init_list
|
||||
fi
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
break;;
|
||||
[Nn]*)
|
||||
cat /dev/null > $NUM_DIR/init_list
|
||||
break;;
|
||||
* )
|
||||
echo "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
#组合安装调用方法
|
||||
function installInit() {
|
||||
|
||||
if [ -f $NUM_DIR/init_list ];then
|
||||
if [ `cat $NUM_DIR/init_list | egrep "init-galaxy-gateway-keepalive|init-kafka|init-hbase|init-druid|init-clickhouse|init-storm|init-spark|init-galaxy-job-service|init-galaxy-hos-service" | wc -l` -gt '0' ]
|
||||
then
|
||||
abnormalInit
|
||||
else
|
||||
initAll
|
||||
fi
|
||||
else
|
||||
initAll
|
||||
fi
|
||||
|
||||
}
|
||||
#======================================init======================================#
|
||||
|
||||
#======================================check======================================#
|
||||
#组合安装正常逻辑,逐个组件询问,Y执行 N不执行安装。
|
||||
#记录数组通过循环顺序执行安装
|
||||
function checkAll() {
|
||||
clear
|
||||
|
||||
i=0
|
||||
ins_names=(check-services check-components)
|
||||
echo ${ins_names[@]} > $NUM_DIR/check_list
|
||||
|
||||
#根据组合进行顺序安装
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
echoSuccess $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
echo ${ins_names[@]} > $NUM_DIR/check_list
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
clear
|
||||
echo -e "
|
||||
\033[32;1mCheck finished, service and component status is normal.\033[0m
|
||||
"
|
||||
sleep 5
|
||||
break
|
||||
}
|
||||
|
||||
#组合安装异常终止执行操作
|
||||
#询问是否需要再上次基础上执行,否则清空文件跳出循环
|
||||
function abnormalCheck() {
|
||||
clear
|
||||
while true; do
|
||||
echo -e "
|
||||
\033[31;1m上次选择部署后还有 `cat $NUM_DIR/check_list`未执行部署,是否继续执行.\033[0m
|
||||
"
|
||||
read -p "y/Y 继续执行安装,n/N 返回选择菜单:" yn
|
||||
case $yn in
|
||||
[Yy]*)
|
||||
i=0
|
||||
#根据组合进行顺序安装
|
||||
list=`cat $NUM_DIR/check_list`
|
||||
ins_names=(${list//,/ })
|
||||
oldnums=${#ins_names[*]}
|
||||
for element in ${ins_names[@]}
|
||||
do
|
||||
ansible-playbook -i ../inventories/pro/hosts $element.yml
|
||||
if [ $? -eq '0' ];then
|
||||
sleep 10
|
||||
echoSuccess $element
|
||||
recordinstnum $element
|
||||
unset ins_names[$i]
|
||||
let i++
|
||||
if [ $i -eq $oldnums ];then
|
||||
cat /dev/null > $NUM_DIR/check_list
|
||||
else
|
||||
echo ${ins_names[@]} > $NUM_DIR/check_list
|
||||
fi
|
||||
else
|
||||
echoError $element
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
clear
|
||||
echo -e "
|
||||
\033[32;1mCheck finished, service and component status is normal.\033[0m
|
||||
"
|
||||
sleep 5
|
||||
break;;
|
||||
[Nn]*)
|
||||
# cat /dev/null > $NUM_DIR/check_list
|
||||
break;;
|
||||
* )
|
||||
echo "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
#组合安装调用方法
|
||||
function installCheck() {
|
||||
|
||||
if [ -f $NUM_DIR/check_list ];then
|
||||
if [ `cat $NUM_DIR/check_list | egrep "check-services|check-components" | wc -l` -gt '0' ]
|
||||
then
|
||||
abnormalCheck
|
||||
else
|
||||
checkAll
|
||||
fi
|
||||
else
|
||||
checkAll
|
||||
fi
|
||||
|
||||
}
|
||||
#======================================check======================================#
|
||||
|
||||
|
||||
while true; do
|
||||
|
||||
if [[ -f $NUM_DIR/checkManager ]]; then
|
||||
if [[ `cat $NUM_DIR/checkManager` -eq 0 ]]; then
|
||||
checkManager
|
||||
fi
|
||||
else
|
||||
checkManager
|
||||
fi
|
||||
|
||||
if [[ -f $NUM_DIR/checkCluster ]]; then
|
||||
if [[ `cat $NUM_DIR/checkCluster` -eq 0 ]]; then
|
||||
checkCluster
|
||||
fi
|
||||
else
|
||||
checkCluster
|
||||
fi
|
||||
|
||||
clear
|
||||
cat ../parcels/menu/homePage
|
||||
|
||||
read -p "
|
||||
Selection(1-4)? " yn
|
||||
case $yn in
|
||||
[1])
|
||||
while true; do
|
||||
clear
|
||||
#installcombination
|
||||
|
||||
cat ../parcels/menu/commonMenu
|
||||
echo " ********************************************************************************************************* "
|
||||
echo " * *
|
||||
* Press Ctrl+C or N to exit, Enter or Y to continue. *
|
||||
* *
|
||||
*********************************************************************************************************
|
||||
"
|
||||
|
||||
read -p "Enter [Y] or [N]: " yn
|
||||
case $yn in
|
||||
[Yy]* )
|
||||
installcombination
|
||||
break;;
|
||||
[Nn]*)
|
||||
break;;
|
||||
* )
|
||||
echo "Please Enter [Y] or [N].";;
|
||||
esac
|
||||
done;;
|
||||
[2] )
|
||||
while true; do
|
||||
clear
|
||||
#installApps
|
||||
|
||||
cat ../parcels/menu/appMenu
|
||||
read -p "Enter [Y] or [N]: " yn
|
||||
case $yn in
|
||||
[Yy]* )
|
||||
installApps
|
||||
break;;
|
||||
[Nn]* )
|
||||
break;;
|
||||
* )
|
||||
echo "Please Enter [Y] or [N].";;
|
||||
esac
|
||||
done;;
|
||||
[3] )
|
||||
installInit
|
||||
;;
|
||||
[4] )
|
||||
installCheck
|
||||
;;
|
||||
* )
|
||||
echo "Please Enter (1-4)."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
617
inventories/pro/group_vars/all
Normal file
617
inventories/pro/group_vars/all
Normal file
@@ -0,0 +1,617 @@
|
||||
#######################
|
||||
#### ####
|
||||
#### 基础配置 ####
|
||||
#### ####
|
||||
#######################
|
||||
#============================基础配置===============================#
|
||||
#根据对应的地区修改;默认为东八区,若为东六区,则修改为:"+06:00"
|
||||
local_time: "+08:00"
|
||||
|
||||
#若使用本安装包安装jdk,则此配置无需更改;若使用其他安装包或已安装过,则指向已有的jdk安装目录
|
||||
java_home: /usr/lib/jvm/jdk1.8.0_73
|
||||
|
||||
#统一安装路径
|
||||
install_path: /home/ceiec
|
||||
|
||||
#数据存储路径,包含数据和日志
|
||||
data_path: /home/ceiec
|
||||
|
||||
#若安装过程中检测到对应组件已存在,是否允许脚本卸载已存在的组件。
|
||||
#仅限本安装包部署的组件。
|
||||
allowed_unload: "yes"
|
||||
|
||||
#============================bifang-Mariadb===============================#
|
||||
|
||||
#Bifang MariaDB 地址,用以galaxy-qgw-service、galaxy-report-service的业务使用。
|
||||
bifang_mariadb_host: 127.0.0.1
|
||||
|
||||
#Bifang mariadb 数据库名
|
||||
bifang_mariadb_database: tsg-bifang
|
||||
|
||||
#Bifang mariadb pin
|
||||
bifang_mariadb_pin: 111111
|
||||
|
||||
|
||||
#galaxy mariadb key
|
||||
galaxy_mariadb_pin: ceiec2019
|
||||
|
||||
|
||||
# 所有安装包路径,可自己指定绝对路径
|
||||
package_path: "{{ playbook_dir | dirname }}/software_packages"
|
||||
#package_path: /opt/software_packages
|
||||
|
||||
|
||||
|
||||
#============================虚IP===============================#
|
||||
|
||||
#-------------apps------------------#
|
||||
|
||||
#Galaxy 业务组件keepalive IP地址,填写的IP只能是和hosts-services配置的IP是同段的,且不能跟同段内已有的IP相同。
|
||||
gateway_keepalive_host: 192.168.44.23
|
||||
|
||||
#Galaxy 业务组件keepalive绑定网卡名称,不支持两个服务器网卡名称不同的情况,此情况需要安装完成后手动修改配置文件
|
||||
gateway_keepalive_interface: eth0
|
||||
|
||||
#Galaxy 业务组件keepalive router_id 注意同网段内此值不可重复
|
||||
gateway_keepalive_router_id: 61
|
||||
|
||||
#-------------hos------------------#
|
||||
#是否需要对hos配置keepalive,若不需要则此处为no,若需要则为yes
|
||||
#此项配置用于在服务器较少环境下,不对galaxy-hos-service服务单独做负载均衡的情况。
|
||||
hos_keepalive_need: "yes"
|
||||
|
||||
#galaxy-hos-service服务keepalive IP地址 若 hos_keepalive_need为no,则此处填写gateway_keepalive_host对应的IP
|
||||
#填写的IP只能是和hosts-hoskeepalive配置的IP是同段的,且不能跟同段内已有的IP相同。
|
||||
hos_keepalive_host: 127.0.0.2
|
||||
|
||||
#galaxy-hos-service服务keepalive绑定网卡名称,不支持两个服务器网卡名称不同的情况,此情况需要安装完成后手>动修改配置文件
|
||||
#若 hos_keepalive_need 配置no则此处 可不进行修改
|
||||
hos_keepalive_interface: eth0
|
||||
|
||||
#galaxy-hos-service服务keepalive router_id 注意同网段内此值不可重复
|
||||
#若 hos_keepalive_need 配置no则此处 可不进行修改
|
||||
hos_keepalive_router_id: 62
|
||||
|
||||
|
||||
#galaxy-keepalive的相关路径(目前gateway和hos共用这个配置)
|
||||
keepalived_package_path: /home/keepalive
|
||||
|
||||
keepalived_soft_home_path: galaxy/workspace/
|
||||
|
||||
|
||||
#============================Kafka===============================#
|
||||
#任务消费kafka地址,若无特殊情况为本安装集群kafka地址,格式:kafkaip1:9092,kafkaip2:9092,kafkaip3:9092.....
|
||||
consumer_kafka_servers: 127.0.0.1:9092
|
||||
|
||||
#任务结果写入kafka地址,若无特殊情况为本安装集群kafka地址,格式:kafkaip1:9092,kafkaip2:9092,kafkaip3:9092.....
|
||||
producer_kafka_servers: 127.0.0.1:9092
|
||||
|
||||
#============================默认配置===============================#
|
||||
#自研服务组件使用nacos 命名空间名称
|
||||
services_config_namespace: prod
|
||||
|
||||
#Galaxy的 Nacos pin
|
||||
nacos_pin: nacos
|
||||
|
||||
#Nacos 使用的mariadb 数据库名称
|
||||
mariadb_nacos_database: nacos
|
||||
|
||||
#Druid 使用的mariadb 数据库名称
|
||||
mariadb_druid_database: druid
|
||||
|
||||
#galaxy-job-service依赖的MariaDB数据库名称
|
||||
mariadb_job_database: xxl_job
|
||||
|
||||
|
||||
|
||||
|
||||
########################
|
||||
##### ####
|
||||
##### 组件配置 ####
|
||||
##### ####
|
||||
########################
|
||||
#===========================druid===============================#
|
||||
#druid服务使用磁盘最大大小,若druid单独使用服务器则配置,服务器可用空间的 75%,单位 字节
|
||||
#原配置名称:druid.server.maxSize
|
||||
server_disk_maxsize: 5000000000000
|
||||
|
||||
#druid 本地最大的缓存大小 单位:字节
|
||||
#原配置名称:druid.segmentCache.locations
|
||||
segmentCache_max_size: 300000000000
|
||||
|
||||
#========Druid-historical节点配置信息========
|
||||
#historical 内存大小,单位:MB
|
||||
historical_mem: 512
|
||||
|
||||
#history 堆外内存指定大小,单位:MB
|
||||
historical_MaxDirectMemorySize: 512
|
||||
|
||||
#historical buffer 大小
|
||||
#原配置名称:druid.processing.buffer.sizeBytes
|
||||
historical_buffer_sizeBytes: 50000000
|
||||
|
||||
#historical numMergeBuffers 大小
|
||||
#原配置名称:druid.processing.numMergeBuffers
|
||||
historical_numMergeBuffers: 4
|
||||
|
||||
#historical numThreads 大小
|
||||
#原配置名称:druid.processing.numThreads
|
||||
historical_numThreads: 5
|
||||
|
||||
#========Druid-middlemanager节点配置信息========
|
||||
#middleManager 任务内存配置
|
||||
#原配置名称:druid.indexer.runner.javaOpts
|
||||
middlemanager_runner_javaOpts: '-Xms512m -Xmx512m -XX:MaxDirectMemorySize=512m'
|
||||
|
||||
#middleManager numMergeBuffers 大小
|
||||
#原配置名称:druid.indexer.fork.property.druid.processing.numMergeBuffers
|
||||
middlemanager_numMergeBuffers: 2
|
||||
|
||||
#middleManager buffer.sizeBytes 大小
|
||||
#原配置名称:druid.indexer.fork.property.druid.processing.buffer.sizeBytes
|
||||
middlemanager_buffer_sizeBytes: 20000000
|
||||
|
||||
#middleManager numThreads 大小
|
||||
#原配置名称:druid.indexer.fork.property.druid.processing.numThreads
|
||||
middlemanager_numThreads: 1
|
||||
|
||||
#========Druid-coordinator节点配置信息========
|
||||
#coordinator-overlord 内存大小,单位:MB
|
||||
coordinator_mem: 512
|
||||
|
||||
#========Druid-broker节点配置信息========
|
||||
#broker 内存大小,单位:MB
|
||||
broker_mem: 512
|
||||
|
||||
#broker 堆外内存指定大小,单位:MB
|
||||
broker_MaxDirectMemorySize: 1024
|
||||
|
||||
#druid处理缓存大小配置,单位:字节
|
||||
#原配置名称:druid.processing.buffer.sizeBytes
|
||||
broker_sizeBytes: 50000000
|
||||
|
||||
#druid处理mergeBuffer大小配置
|
||||
#原配置名称:druid.processing.numMergeBuffers
|
||||
broker_numMergeBuffers: 6
|
||||
|
||||
#druid处理线程数量配置
|
||||
#原配置名称:druid.processing.numThreads
|
||||
broker_numThreads: 1
|
||||
|
||||
#===========================Hadoop===============================#
|
||||
#namenode 进程使用内存大小,单位:MB
|
||||
namenode_mem: 512
|
||||
|
||||
#datanode 进程使用内存大小,单位:MB
|
||||
datanode_mem: 512
|
||||
|
||||
#journalnode 进程使用内存大小,单位:MB
|
||||
journal_mem: 1024
|
||||
|
||||
#zkfc 进程使用内存大小,单位:MB
|
||||
zkfc_mem: 1024
|
||||
|
||||
#namenode 工作线程池大小
|
||||
#原配置名称:dfs.namenode.handler.count
|
||||
namenode_handlers: 40
|
||||
|
||||
#datanode 工作线程池大小
|
||||
#原配置名称:dfs.datanode.handler.count
|
||||
datanode_handlers: 40
|
||||
|
||||
#===========================HBase===============================#
|
||||
#Hmaster进程使用的内存,单位:MB
|
||||
master_mem: 1024
|
||||
|
||||
#Hregionserver进程使用的内存,单位:MB
|
||||
region_mem: 2048
|
||||
|
||||
#Hregionserver进程young内存大小,单位:MB
|
||||
region_young_mem: 512
|
||||
|
||||
#regionserver处理线程数,一般和cpu数相同,也可为核数的整数倍
|
||||
#原配置名称:hbase.regionserver.handler.count
|
||||
regionserverhandlers: 32
|
||||
|
||||
#===========================Kafka===============================#
|
||||
#kafka 进程使用最大内存,单位:MB
|
||||
kafka_max_mem: 1024
|
||||
|
||||
#kafka 进程初始最小内存,单位:MB
|
||||
kafka_min_mem: 512
|
||||
|
||||
#kafka数据存储时间 单位:小时,默认 168
|
||||
log_reten_hours: 168
|
||||
|
||||
#topic一个分区最大存储多少字节,默认 1G
|
||||
topic_max_bytes: 10737418240
|
||||
|
||||
#topic一个分区内单个数据文件最大多少字节,默认 1G
|
||||
#超过会删除,但删除需要时间,即一个partition下可能存在新旧多个文件,一般旧文件不超过两个。
|
||||
topic_file_bytes: 1073741824
|
||||
|
||||
#===========================Mariadb===============================#
|
||||
#缓冲池字节大小 单位,单位:MB
|
||||
mariadb_innodb_buffer_pool_size: 1024
|
||||
|
||||
#===========================Spark===============================#
|
||||
#spark worker 节点内存,单位:MB
|
||||
spark_worker_mem: 512
|
||||
|
||||
#spark worker节点处理线程数
|
||||
spark_worker_cores: 30
|
||||
|
||||
#===========================Nacos===============================#
|
||||
#Nacos 内存配置
|
||||
nacos_java_opt: '-Xms1024m -Xmx1024m -Xmn1024m'
|
||||
|
||||
#===========================Storm===============================#
|
||||
#单个supervisor可使用worker数量,一般为CPU的一半。
|
||||
storm_slot_nums: 25
|
||||
|
||||
#单个worker内存大小,单位:MB
|
||||
storm_worker_max_mem: 1024
|
||||
|
||||
#单个worker内存大小,单位:MB
|
||||
storm_worker_min_mem: 1024
|
||||
|
||||
#===========================Zookeeper===============================#
|
||||
#zookeeper 进程 启动内存大小 单位MB
|
||||
zookeeper_max_mem: 1024
|
||||
|
||||
#===========================Mariadb===============================#
|
||||
#mariadb 端口
|
||||
galaxy_mariadb_port: 3306
|
||||
|
||||
#mariadb 用户
|
||||
galaxy_mariadb_username: root
|
||||
|
||||
|
||||
|
||||
########################
|
||||
##### ####
|
||||
##### 业务配置 ####
|
||||
##### ####
|
||||
########################
|
||||
#=======================galaxy-hos-service==========================#
|
||||
#galaxy-hos-service服务 tomcat缓存大小,单位KB
|
||||
hos_tomcat_cache_size: 100000
|
||||
|
||||
#galaxy-hos-service 服务内存设置
|
||||
hos_java_opts: "-Xmx512m -Xms512m -Xmn512m"
|
||||
|
||||
#=======================galaxy-qgw-service==========================#
|
||||
#galaxy-qgw-service 服务内存设置
|
||||
qgw_java_opts: "-Xmx512m -Xms512m"
|
||||
|
||||
#=======================galaxy-job-service==========================#
|
||||
#galaxy-job-service 服务内存设置
|
||||
job_java_opts: "-Xmx512m -Xms512m"
|
||||
|
||||
#======================galaxy-report-service=========================#
|
||||
#galaxy-report-service 服务内存设置
|
||||
report_java_opts: "-Xmx512m -Xms512m"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
########################
|
||||
##### ####
|
||||
##### 开发者配置 ####
|
||||
##### ####
|
||||
########################
|
||||
|
||||
#------zookeeper---------#
|
||||
zookeeper_version: zookeeper-3.4.10
|
||||
|
||||
#zookeeper myid起始id,如不是扩容则此处无需修改;若为扩容,则此处改为原集群节点 myid最大值+1
|
||||
zk_start_myid: 1
|
||||
|
||||
#zookeeper port
|
||||
zookeeper_port: 2181
|
||||
|
||||
|
||||
#------mariadb---------#
|
||||
#mariadb数据目录
|
||||
mariadb_datadir_path: /data/mariadb
|
||||
|
||||
|
||||
|
||||
#-----nacos---------#
|
||||
#nacos version
|
||||
nacos_version: nacos-2.0.2
|
||||
|
||||
#nacos local port
|
||||
nacos_port: 8847
|
||||
|
||||
|
||||
|
||||
#-----kafka---------#
|
||||
#Kafka版本
|
||||
kafka_version: kafka_2.11-1.0.0
|
||||
|
||||
#kafka-manager 版本
|
||||
kafka_manager_version: kafka-manager-1.3.3.18
|
||||
|
||||
#kafka broker起始id
|
||||
kafka_start_broker: 1
|
||||
|
||||
#kafka default port
|
||||
server_port: 9092
|
||||
|
||||
|
||||
|
||||
#------storm---------#
|
||||
storm_version: apache-storm-1.0.2
|
||||
|
||||
|
||||
|
||||
#-------hadoop---------#
|
||||
hadoop_version: hadoop-2.7.1
|
||||
|
||||
|
||||
|
||||
#--------Hbase---------#
|
||||
hbase_version: hbase-2.2.3
|
||||
|
||||
|
||||
#------Clickhouse---------#
|
||||
#clickhouse 版本
|
||||
clickhouse_version: 20.3.12.112
|
||||
|
||||
#clickhouse默认的数据库
|
||||
default_database: default
|
||||
|
||||
#clickhouse 只读key
|
||||
readonly_key: ceiec2018
|
||||
|
||||
#clickhouse 管理key
|
||||
root_key: ceiec2019
|
||||
|
||||
|
||||
|
||||
#-------druid---------#
|
||||
#druid 版本
|
||||
druid_version: apache-druid-0.18.1
|
||||
|
||||
#druid 集群数量限制
|
||||
cluster_limit: "4"
|
||||
|
||||
|
||||
|
||||
#------Spark---------#
|
||||
spark_version: spark-2.2.3-bin-hadoop2.7
|
||||
|
||||
scala_version: scala-2.11.7
|
||||
|
||||
#请勿修改此配置,安装过程会自动安装此版本scala。
|
||||
scala_home: /usr/lib/scala/scala-2.11.7
|
||||
|
||||
|
||||
|
||||
|
||||
#-----arangodb---------#
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
arangodb_password: ceiec2018
|
||||
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
arangodb_image_tar_name: arangodb-3.6.4.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#设置容器的hostname
|
||||
#container_hostname: bifang-api
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
arangodb_image_name: arangodb
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
arangodb_image_tag_name: 3.6.4
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
arangodb_image_container_name: arangodb
|
||||
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
arangodb_soft_home_path: galaxy/workspace/arangodb
|
||||
|
||||
#挂载目录的相对路径,不要随意修改
|
||||
arango_volume_path: galaxy/volumes/arangodb
|
||||
|
||||
|
||||
|
||||
|
||||
#------environment---------#
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
jdk_home_path: /usr/lib/jvm
|
||||
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
#执行脚本的目录
|
||||
test_soft_home_path: /home/test/check_begin
|
||||
|
||||
|
||||
|
||||
#--------galaxy-chproxy---------#
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
chproxy_image_tar_name: chproxy-21.06.30.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
chproxy_image_name: galaxy-chproxy
|
||||
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
chproxy_image_tag_name: 21.06.30
|
||||
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
chproxy_image_container_name: galaxy-chproxy
|
||||
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
chproxy_soft_home_path: galaxy/workspace/galaxy-chproxy
|
||||
|
||||
#挂载目录的相对路径,不要随意修改
|
||||
chproxy_volume_path: galaxy/volumes/galaxy-chproxy
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------galaxy-gateway-nginx---------#
|
||||
gateway_image_tar_name: nginx-metrics-1.17.0.tar
|
||||
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
gateway_image_name: galaxy-gateway-nginx
|
||||
|
||||
##{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
gateway_image_tag_name: 1.17.0
|
||||
|
||||
##{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
gateway_image_container_name: galaxy-gateway-nginx
|
||||
|
||||
#宿主机存放与nginx容器映射的data目录和log的文件夹
|
||||
gateway_nginx_soft_home_path: galaxy/workspace/galaxy-gateway-nginx #注意路径最后面没有/
|
||||
|
||||
#nginx 数据目录
|
||||
gateway_nginx_volume_path: galaxy/volumes/galaxy-gateway-nginx
|
||||
|
||||
|
||||
|
||||
|
||||
#--------galaxy-gohangout---------#
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
gohangout_image_tar_name: gohangout-1.15.2.20210408.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
gohangout_image_name: gohangout
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
gohangout_image_tag_name: 1.15.2.20210408
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
gohangout_image_container_name: gohangout
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
gohangout_soft_home_path: galaxy/workspace/gohangout
|
||||
|
||||
#挂载容器目录的相对路径,不要随意更改
|
||||
gohangout_volume_path: galaxy/volumes/gohangout
|
||||
|
||||
|
||||
|
||||
#--------galaxy-hos-nginx---------#
|
||||
hos_nginx_image_tar_name: nginx-metrics-1.17.0.tar
|
||||
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
hos_nginx_image_name: galaxy-hos-nginx
|
||||
|
||||
##{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
hos_nginx_image_tag_name: 1.17.0
|
||||
|
||||
##{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
hos_nginx_image_container_name: galaxy-hos-nginx
|
||||
|
||||
#宿主机存放与nginx容器映射的data目录和log的文件夹
|
||||
hos_nginx_soft_home_path: galaxy/workspace/galaxy-hos-nginx #注意路径最后面没有/
|
||||
|
||||
#nginx 数据目录
|
||||
hos_nginx_volume_path: galaxy/volumes/galaxy-hos-nginx
|
||||
|
||||
|
||||
|
||||
#---------galaxy-hos-service---------#
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
hos_service_image_tar_name: galaxy-hos-service-21.07.01.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
hos_service_image_name: galaxy-hos-service
|
||||
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
hos_service_image_tag_name: 21.07.01
|
||||
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
hos_service_image_container_name: galaxy-hos-service
|
||||
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
hos_service_soft_home_path: galaxy/workspace/galaxy-hos-service
|
||||
|
||||
#挂载目录的相对路径,不要随意修改
|
||||
hos_volume_path: galaxy/volumes/galaxy-hos-service
|
||||
|
||||
|
||||
|
||||
#---------galaxy-job-service.yml---------#
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
job_image_tar_name: galaxy-job-executor-v1.3.210413-rc1.tar
|
||||
admin_image_tar_name: galaxy-job-admin-v1.3.20210408.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#设置容器的hostname
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
job_image_name: galaxy-job-executor
|
||||
admin_image_name: galaxy-job-admin
|
||||
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
job_image_tag_name: v1.3.210413-rc1
|
||||
admin_image_tag_name: v1.3.20210408
|
||||
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
job_image_container_name: galaxy-job-executor
|
||||
admin_image_container_name: galaxy-job-admin
|
||||
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
job_soft_home_path: galaxy/workspace/galaxy-job/galaxy-job-executor
|
||||
admin_soft_home_path: galaxy/workspace/galaxy-job/galaxy-job-admin
|
||||
|
||||
#挂载目录的相对路径,不要随意修改
|
||||
job_volume_path: galaxy/volumes/galaxy-job/galaxy-job-executor
|
||||
admin_volume_path: galaxy/volumes/galaxy-job/galaxy-job-admin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------galaxy-qgw-service---------#
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
qgw_image_tar_name: galaxy-qgw-service-345.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
qgw_image_name: galaxy-qgw-service
|
||||
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
qgw_image_tag_name: 345
|
||||
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
qgw_image_container_name: galaxy-qgw-service
|
||||
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
qgw_soft_home_path: galaxy/workspace/galaxy-qgw-service
|
||||
|
||||
#挂载目录的相对路径,不要随意修改
|
||||
qgw_volume_path: galaxy/volumes/galaxy-qgw-service
|
||||
|
||||
|
||||
|
||||
|
||||
#---------galaxy-report-service---------#
|
||||
#注意这里面定义的key中不能包含减号-,否则程序无法识别定义的key
|
||||
#离线模式下使用:bifang-api的docker镜像文件名称,在../file中的文件名称
|
||||
report_image_tar_name: galaxy-report-service-21.04.07.tar
|
||||
|
||||
##########################公共属性#############################
|
||||
#{{ image_tar_name }}中的镜像名称,或者{{ docker_registry_image_and_tag }}中的镜像名称,不含版本号
|
||||
report_image_name: galaxy-report-service
|
||||
|
||||
#{{ image_tar_name }}的镜像版本号,或者{{ docker_registry_image_and_tag }}中的镜像版本号
|
||||
report_image_tag_name: 21.04.07
|
||||
|
||||
#{{ image_tar_name }}的镜像,或者{{ docker_registry_image_and_tag }}中的镜像启动后的容器名称
|
||||
report_image_container_name: galaxy-report-service
|
||||
|
||||
#镜像文件,docker-compose文件以及数据卷共享目录所在的位置,注意路径最后面不带/
|
||||
report_soft_home_path: galaxy/workspace/galaxy-report-service
|
||||
|
||||
#report 数据目录
|
||||
report_volume_path: galaxy/volumes/galaxy-report-service
|
||||
49
inventories/pro/hosts
Normal file
49
inventories/pro/hosts
Normal file
@@ -0,0 +1,49 @@
|
||||
#此标签指定的IP用于:chproxy、galaxy-app-nginx、galaxy-job-service、galaxy-qgw-service、galaxy-report-service、galaxy-app-keepalive的安装
|
||||
#最少需要指定两台。
|
||||
[services]
|
||||
|
||||
#此标签指定的IP用于:galaxy-hos-service 的安装
|
||||
[hos]
|
||||
|
||||
#此标签指定的IP用于:galaxy-hos-keepalive和galaxy-hos-nginx的安装
|
||||
#config.yml内的hos_keepalive_need配置是no,则此处不写任何IP,yes就写部署galaxy-hos-service服务keepalive的服务器地址。
|
||||
#不能与services指定的IP相同,且最多为两台。
|
||||
[hoskeepalive]
|
||||
|
||||
#此标签指定的IP用于:ArangoDB的安装
|
||||
[arangodb]
|
||||
|
||||
#此标签指定的IP用于:Mariadb的安装,目前版本下仅可配置两个IP,且需要与services标签的前两个IP相同。
|
||||
#现没有负载需求,保留后期做负载的功能需求。
|
||||
[mariadb]
|
||||
|
||||
#此标签指定的IP用于:Nacos的安装
|
||||
[nacos]
|
||||
|
||||
#此标签指定的IP用于:Apache Zookeeper的安装
|
||||
[zookeeper]
|
||||
|
||||
#此标签指定的IP用于:Apache Kafka的安装,集群第一台同时部署Kafka-Manager服务。
|
||||
[kafka]
|
||||
|
||||
#此标签指定的IP用于:Apache Storm的安装,根据内部约定,若集群整体小于3台则第一台为numbus节点;大于三台则前三台为nimbus节点。
|
||||
[storm]
|
||||
|
||||
#此标签指定的IP用于:Apache Hadoop的安装
|
||||
[hadoop]
|
||||
|
||||
#此标签指定的IP用于:Apache HBase的安装
|
||||
[hbase]
|
||||
|
||||
#此标签指定的IP用于:Apache Spark的安装,根据内部约定,若集群小于3台则worker在所有节点上;大于3台则第一个节点为master节点。
|
||||
[spark]
|
||||
|
||||
#此标签指定的IP用于:Galaxy-Gohangout的安装
|
||||
[gohangout]
|
||||
|
||||
#此标签指定的IP用于:Apache Druid的安装,根据内部约定,若集群整体小于4台则每台为全部节点;大于4台则前两台默认为query节点。
|
||||
[druid]
|
||||
|
||||
#此标签指定的IP用于:Clickhouse的安装,根据内部约定,前两台默认为query节点。
|
||||
[clickhouse]
|
||||
|
||||
8
parcels/Arangodb.yml
Normal file
8
parcels/Arangodb.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
- hosts: arangodb
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/arangodb
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - roles/components/arangodb/vars/main.yml
|
||||
28
parcels/Clickhouse.yml
Normal file
28
parcels/Clickhouse.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
- hosts: clickhouse
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/clickhouse/common
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - roles/components/clickhouse/common/vars/main.yml
|
||||
|
||||
- hosts: clickhouse
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/clickhouse/query
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - roles/components/clickhouse/common/vars/main.yml
|
||||
|
||||
- hosts: clickhouse
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/clickhouse/data
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - roles/components/clickhouse/common/vars/main.yml
|
||||
|
||||
8
parcels/Druid.yml
Normal file
8
parcels/Druid.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
- hosts: druid
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/druid
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - roles/components/druid/vars/main.yml
|
||||
10
parcels/HBase.yml
Normal file
10
parcels/HBase.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts: hbase
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/hbase
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/hbase/vars/main.yml
|
||||
|
||||
11
parcels/Hadoop.yml
Normal file
11
parcels/Hadoop.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
- hosts: hadoop
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/hadoop
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/hadoop/vars/main.yml
|
||||
|
||||
|
||||
11
parcels/Kafka.yml
Normal file
11
parcels/Kafka.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
- hosts: kafka
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/kafka
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/kafka/vars/main.yml
|
||||
|
||||
20
parcels/Mariadb.yml
Normal file
20
parcels/Mariadb.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
- hosts: mariadb
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/mariadb/install-mariadb-cluster
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/mariadb/install-mariadb-cluster/vars/main.yml
|
||||
|
||||
- hosts: mariadb
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/mariadb/mariadb-double-master
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/mariadb/install-mariadb-cluster/vars/main.yml
|
||||
10
parcels/Nacos.yml
Normal file
10
parcels/Nacos.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
- hosts: nacos
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/nacos
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/nacos/vars/main.yml
|
||||
10
parcels/Spark.yml
Normal file
10
parcels/Spark.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
- hosts: spark
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/spark
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/spark/vars/main.yml
|
||||
11
parcels/Storm.yml
Normal file
11
parcels/Storm.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
- hosts: storm
|
||||
remote_user: root
|
||||
roles:
|
||||
- components/storm
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/storm/vars/main.yml
|
||||
|
||||
12
parcels/Zookeeper.yml
Normal file
12
parcels/Zookeeper.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
- hosts: zookeeper
|
||||
remote_user: root
|
||||
# max_fail_percentage: 0
|
||||
roles:
|
||||
- components/zookeeper
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/zookeeper/vars/main.yml
|
||||
|
||||
6
parcels/check-components.yml
Normal file
6
parcels/check-components.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
roles:
|
||||
- check/check-components
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
6
parcels/check-services.yml
Normal file
6
parcels/check-services.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- check/check-services
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
25
parcels/environment.yml
Normal file
25
parcels/environment.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
#安装JDK
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
roles:
|
||||
- dependencies/install-jdk
|
||||
# vars_files:
|
||||
# - roles/dependencies/install-jdk/vars/main.yml
|
||||
# - ../configurations/config.yml
|
||||
|
||||
#安装pip和docker
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
roles:
|
||||
- dependencies/install-docker
|
||||
- dependencies/install-pip
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
roles:
|
||||
- dependencies/check-env
|
||||
# vars_files:
|
||||
# - roles/dependencies/check-env/vars/main.yml
|
||||
# - ../configurations/config.yml
|
||||
9
parcels/galaxy-chproxy.yml
Normal file
9
parcels/galaxy-chproxy.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-chproxy
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-chproxy/vars/main.yml
|
||||
9
parcels/galaxy-gateway-keepalive.yml
Normal file
9
parcels/galaxy-gateway-keepalive.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-gateway-keepalive
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-gateway-keepalive/vars/main.yml
|
||||
9
parcels/galaxy-gateway-nginx.yml
Normal file
9
parcels/galaxy-gateway-nginx.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-gateway-nginx
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-gateway-nginx/vars/main.yml
|
||||
9
parcels/galaxy-gohangout.yml
Normal file
9
parcels/galaxy-gohangout.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: gohangout
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-gohangout
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-gohangout/vars/main.yml
|
||||
9
parcels/galaxy-hos-keepalive.yml
Normal file
9
parcels/galaxy-hos-keepalive.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: hoskeepalive
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-hos-keepalive
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-hos-keepalive/vars/main.yml
|
||||
9
parcels/galaxy-hos-nginx.yml
Normal file
9
parcels/galaxy-hos-nginx.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: hoskeepalive
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-hos-nginx
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-hos-nginx/vars/main.yml
|
||||
10
parcels/galaxy-hos-service.yml
Normal file
10
parcels/galaxy-hos-service.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts: hos
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-hos-service
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-hos-service/vars/main.yml
|
||||
|
||||
9
parcels/galaxy-job-service.yml
Normal file
9
parcels/galaxy-job-service.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-job-service
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-job-service/vars/main.yml
|
||||
10
parcels/galaxy-qgw-service.yml
Normal file
10
parcels/galaxy-qgw-service.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-qgw-service
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-qgw-service/vars/main.yml
|
||||
|
||||
10
parcels/galaxy-report-service.yml
Normal file
10
parcels/galaxy-report-service.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- services/galaxy-report-service
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-report-service/vars/main.yml
|
||||
|
||||
10
parcels/init-clickhouse.yml
Normal file
10
parcels/init-clickhouse.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts:
|
||||
- clickhouse
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/clickhouse
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/clickhouse/common/vars/main.yml
|
||||
9
parcels/init-druid.yml
Normal file
9
parcels/init-druid.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: druid
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/druid
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/components/druid/vars/main.yml
|
||||
9
parcels/init-galaxy-gateway-keepalive.yml
Normal file
9
parcels/init-galaxy-gateway-keepalive.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/galaxy-gateway-keepalive
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-gateway-keepalive/vars/main.yml
|
||||
9
parcels/init-galaxy-hos-service.yml
Normal file
9
parcels/init-galaxy-hos-service.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- hosts: services
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/galaxy-hos-service
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-hos-service/vars/main.yml
|
||||
10
parcels/init-galaxy-job-service.yml
Normal file
10
parcels/init-galaxy-job-service.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts:
|
||||
- services
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/galaxy-job-service
|
||||
# vars_files:
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
# - roles/services/galaxy-job-service/vars/main.yml
|
||||
10
parcels/init-hbase.yml
Normal file
10
parcels/init-hbase.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts:
|
||||
- hbase
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/hbase
|
||||
# vars_files:
|
||||
# - roles/components/hbase/vars/main.yml
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
10
parcels/init-kafka.yml
Normal file
10
parcels/init-kafka.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts:
|
||||
- kafka
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/kafka
|
||||
# vars_files:
|
||||
# - roles/components/kafka/vars/main.yml
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
10
parcels/init-spark.yml
Normal file
10
parcels/init-spark.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts:
|
||||
- spark
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/spark
|
||||
# vars_files:
|
||||
# - roles/components/spark/vars/main.yml
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
10
parcels/init-storm.yml
Normal file
10
parcels/init-storm.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- hosts:
|
||||
- storm
|
||||
remote_user: root
|
||||
roles:
|
||||
- init/storm
|
||||
# vars_files:
|
||||
# - roles/components/storm/vars/main.yml
|
||||
# - ../configurations/config.yml
|
||||
# - ../configurations/components.yml
|
||||
# - ../configurations/services.yml
|
||||
20
parcels/menu/appMenu
Normal file
20
parcels/menu/appMenu
Normal file
@@ -0,0 +1,20 @@
|
||||
Service Components:
|
||||
|
||||
┌──────────────────────────────────────┐
|
||||
├ galaxy-qgw-service ┤
|
||||
├ galaxy-job-service ┤
|
||||
├ galaxy-report-service ┤
|
||||
├ galaxy-hos-service ┤
|
||||
├ galaxy-chproxy ┤
|
||||
├ galaxy-gohangout ┤
|
||||
├ galaxy-gateway-nginx ┤
|
||||
├ galaxy-nginx-hos ┤
|
||||
├ galaxy-gateway-keepalive ┤
|
||||
├ galaxy-hos-keepalive ┤
|
||||
└──────────────────────────────────────┘
|
||||
|
||||
*********************************************************
|
||||
* Press Ctrl+C or N to exit, Enter or Y to continue. *
|
||||
* *
|
||||
*********************************************************
|
||||
|
||||
17
parcels/menu/commonMenu
Normal file
17
parcels/menu/commonMenu
Normal file
@@ -0,0 +1,17 @@
|
||||
Open Source Software:
|
||||
|
||||
┌────────────────────────────────┐
|
||||
├ [*] Apache Zookeeper ┤
|
||||
├ [*] Mariadb ┤
|
||||
├ [*] Nacos ┤
|
||||
├ [*] Apache Kafka ┤
|
||||
├ [*] Apache Storm ┤
|
||||
├ [*] Apache Hadoop ┤
|
||||
├ [*] Apache HBase ┤
|
||||
├ [*] Clickhouse ┤
|
||||
├ [*] Apache Druid ┤
|
||||
├ [*] Apache Spark ┤
|
||||
├ [*] ArangoDB ┤
|
||||
└────────────────────────────────┘
|
||||
|
||||
|
||||
15
parcels/menu/homePage
Normal file
15
parcels/menu/homePage
Normal file
@@ -0,0 +1,15 @@
|
||||
Galaxy Data Platform Cluster - TSG21.06
|
||||
|
||||
Please choose one of the following:
|
||||
|
||||
┌────────────────────────────────────────────────────┐
|
||||
├ Step 1:Install Open Source Software ┤
|
||||
├ Step 2:Install Service Components ┤
|
||||
├ Step 3:Install Init Script ┤
|
||||
├ Step 4:Test & Validation ┤
|
||||
└────────────────────────────────────────────────────┘
|
||||
|
||||
******************************************************
|
||||
* Press Ctrl+C (^C) to exit, Enter to continue. *
|
||||
******************************************************
|
||||
|
||||
25
parcels/roles/check/check-components/tasks/main.yml
Normal file
25
parcels/roles/check/check-components/tasks/main.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- name: Checking Strom Topology Num
|
||||
shell: "source /etc/profile && storm list | grep 'ACTIVE' | wc -l"
|
||||
register: stormlist
|
||||
run_once: true
|
||||
delegate_to: '{{ groups.storm[0] }}'
|
||||
|
||||
- name: Checking Strom Topology Num
|
||||
fail:
|
||||
msg: "storm 提交任务数量与版本对应任务数量不匹配,请检查"
|
||||
when: stormlist.stdout < '15'
|
||||
run_once: true
|
||||
delegate_to: '{{ groups.storm[0] }}'
|
||||
|
||||
- name: Checking Gohangout Num
|
||||
shell: "ps -ef | grep gohangout | grep worker | grep -v grep | wc -l"
|
||||
register: golist
|
||||
run_once: true
|
||||
delegate_to: '{{ groups.gohangout[0] }}'
|
||||
|
||||
- name: Checking Gohangout Num
|
||||
fail:
|
||||
msg: "Gohangout 任务启动数据量与版本对应任务数量不匹配,请检查"
|
||||
when: golist.stdout < '10'
|
||||
run_once: true
|
||||
delegate_to: '{{ groups.gohangout[0] }}'
|
||||
67
parcels/roles/check/check-services/tasks/main.yml
Normal file
67
parcels/roles/check/check-services/tasks/main.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
- name: Checking Components Heartbeats
|
||||
shell: "curl -s http://{{ inventory_hostname }}:8183/monitor/health | grep DOWN | grep -v grep | wc -l"
|
||||
register: health
|
||||
|
||||
- name: Checking Components Heartbeats
|
||||
fail:
|
||||
msg: "组件心跳检测异常,请通过接口 curl -s http://{{ inventory_hostname }}:8183/monitor/health 检查具体DOWN组件。"
|
||||
when: health.stdout != '0'
|
||||
|
||||
- name: Checking Metadata
|
||||
shell: "curl -s http://{{ inventory_hostname }}:8183/diagnosis/metadata | grep '\"status\":200' | grep -v grep | wc -l"
|
||||
register: metadata
|
||||
|
||||
- name: Checking Metadata
|
||||
fail:
|
||||
msg: "元数据验证异常,请通过接口 curl -s http://{{ inventory_hostname }}:8183/diagnosis/metadata 检查具体异常信息。"
|
||||
when: metadata.stdout != '1'
|
||||
|
||||
- name: Checking SQL
|
||||
shell: "curl -s http://{{ inventory_hostname }}:8183/diagnosis/runSql | grep '\"status\":200' | grep -v grep | wc -l"
|
||||
register: sql
|
||||
|
||||
- name: Checking SQL
|
||||
fail:
|
||||
msg: "系统内置的SQL数据集执行异常,请通过接口 curl -s http://{{ inventory_hostname }}:8183/diagnosis/runSql 检查具体异常信息。"
|
||||
when: sql.stdout != '1'
|
||||
|
||||
#TODO 因服务版本问题,于21.07版本开启验证
|
||||
#- name: Checking {{ groups.hos[0] }} galaxy-hos-service
|
||||
# shell: "curl --location -s -w %{http_code} http://{{ groups.hos[0] }}:8186/monitor | grep 200 | wc -l"
|
||||
# register: monitor_out
|
||||
# run_once: true
|
||||
# delegate_facts: true
|
||||
# delegate_to: '{{ groups.hos[0] }}'
|
||||
#
|
||||
#- fail:
|
||||
# msg: "HOS Monitor检测异常,请通过接口 curl --location -s -w %{http_code} http://{{ groups.hos[0] }}:8186/monitor 检查具体异常信息"
|
||||
# when: monitor_out.stdout != '1'
|
||||
#
|
||||
#- name: Checking {{ groups.hos[1] }} galaxy-hos-service
|
||||
# shell: "curl --location -s -w %{http_code} http://{{ groups.hos[1] }}:8186/monitor | grep 200 | wc -l"
|
||||
# register: monitor_out
|
||||
# run_once: true
|
||||
# delegate_facts: true
|
||||
# delegate_to: '{{ groups.hos[1] }}'
|
||||
#
|
||||
#- fail:
|
||||
# msg: "HOS Monitor检测异常,请通过接口 curl --location -s -w %{http_code} http://{{ groups.hos[1] }}:8186/monitor 检查具体异常信息"
|
||||
# when: monitor_out.stdout != '1'
|
||||
|
||||
- name: wait gohangout start ,sleep 30s
|
||||
shell: sleep 30
|
||||
|
||||
- name: Checking gohangout start job Num
|
||||
shell: "ps -ef | grep gohangout | grep worker | grep -v grep | wc -l"
|
||||
register: check_out
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: '{{ groups.gohangout[1] }}'
|
||||
|
||||
- fail:
|
||||
msg: "{{ inventory_hostname }}- gohangout start job num is not all. Please check it"
|
||||
when: check_out.stdout < '10'
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: '{{ groups.gohangout[1] }}'
|
||||
|
||||
BIN
parcels/roles/components/arangodb/files/arangodb.tar.gz
Normal file
BIN
parcels/roles/components/arangodb/files/arangodb.tar.gz
Normal file
Binary file not shown.
BIN
parcels/roles/components/arangodb/files/conf.bak.tar
Normal file
BIN
parcels/roles/components/arangodb/files/conf.bak.tar
Normal file
Binary file not shown.
57
parcels/roles/components/arangodb/tasks/load_arangodb.yml
Normal file
57
parcels/roles/components/arangodb/tasks/load_arangodb.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
- name: stop and remove {{ arangodb_image_container_name }} container
|
||||
docker_container:
|
||||
name: '{{ arangodb_image_container_name }}'
|
||||
state: absent
|
||||
|
||||
- name: remove old {{ arangodb_image_name }} image
|
||||
docker_image:
|
||||
name: '{{ arangodb_image_name }}'
|
||||
tag: '{{ arangodb_image_tag_name }}'
|
||||
state: absent
|
||||
|
||||
- name: create {{ data_path }}/{{ arangodb_soft_home_path }}
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ data_path }}/{{ arangodb_soft_home_path }}'
|
||||
|
||||
- name: create {{ data_path }}/{{ arango_volume_path }}
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ data_path }}/{{ arango_volume_path }}'
|
||||
|
||||
|
||||
- name: copy {{ arangodb_image_tar_name }}
|
||||
copy:
|
||||
src: '{{ package_path }}/{{ arangodb_image_tar_name }}'
|
||||
dest: '{{ data_path }}/{{ arangodb_soft_home_path }}/{{ arangodb_image_tar_name }}'
|
||||
force: true
|
||||
backup: yes
|
||||
|
||||
- name: copy arangodb tar file
|
||||
copy:
|
||||
src: '../files/arangodb.tar.gz'
|
||||
dest: '{{ data_path }}/{{ arango_volume_path }}/'
|
||||
force: true
|
||||
backup: yes
|
||||
|
||||
- name: tar -zxvf arangodb.tar.gz
|
||||
shell: cd {{ data_path }}/{{ arango_volume_path }}/ && tar -zxvf arangodb.tar.gz && rm -rf arangodb.tar.gz
|
||||
|
||||
- name: load new {{ arangodb_image_name }} image from {{ arangodb_image_tar_name }}
|
||||
docker_image:
|
||||
name: '{{ arangodb_image_name }}'
|
||||
tag: '{{ arangodb_image_tag_name }}'
|
||||
load_path: '{{ data_path }}/{{ arangodb_soft_home_path }}/{{ arangodb_image_tar_name }}'
|
||||
source: load
|
||||
force_tag: yes
|
||||
force_source: yes
|
||||
|
||||
- name: copy {{ arangodb_image_name }} docker-compose.yml
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: '{{ data_path }}/{{ arangodb_soft_home_path }}/docker-compose.yml'
|
||||
backup: yes
|
||||
|
||||
- name: start {{ arangodb_image_container_name }} container
|
||||
docker_compose:
|
||||
project_src: '{{ data_path }}/{{ arangodb_soft_home_path }}'
|
||||
2
parcels/roles/components/arangodb/tasks/main.yml
Normal file
2
parcels/roles/components/arangodb/tasks/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
#- include: update_python3_and_docker_py.yml
|
||||
- include: load_arangodb.yml
|
||||
@@ -0,0 +1,19 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
arangodb:
|
||||
image: {{ arangodb_image_name }}:{{ arangodb_image_tag_name }}
|
||||
restart: always
|
||||
container_name: {{ arangodb_image_container_name }}
|
||||
environment:
|
||||
ARANGO_ROOT_PASSWORD: "{{ arangodb_password }}"
|
||||
ports:
|
||||
- "8529:8529"
|
||||
volumes:
|
||||
- "{{ data_path }}/{{ arango_volume_path }}/conf:/etc/arangodb3"
|
||||
- "{{ data_path }}/{{ arango_volume_path }}/data:/var/lib/arangodb3"
|
||||
- "{{ data_path }}/{{ arango_volume_path }}/log:/var/log/arangodb3"
|
||||
- "/etc/localtime:/etc/localtime:ro"
|
||||
- "/etc/timezone:/etc/timezone:ro"
|
||||
restart: always
|
||||
network_mode: "host"
|
||||
0
parcels/roles/components/arangodb/vars/main.yml
Normal file
0
parcels/roles/components/arangodb/vars/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
192.168.44.35
|
||||
@@ -0,0 +1,2 @@
|
||||
192.168.44.33
|
||||
192.168.44.34
|
||||
@@ -0,0 +1,172 @@
|
||||
- name: Check whether the CPU supports the SSE4_2 instruction set
|
||||
shell: lscpu |grep sse4_2 | wc -l
|
||||
register: check_cpu_out
|
||||
|
||||
- fail:
|
||||
msg: "检测目标服务器集群内存在CPU不支持SSE4_2指令集的节点,请检查"
|
||||
when: check_cpu_out.stdout < '1'
|
||||
|
||||
- block:
|
||||
- name: Check if the Clickhouse service already exists
|
||||
shell: rpm -qa | grep clickhouse | wc -l
|
||||
register: check_out
|
||||
- name: copy unload_ck.sh to {{ install_path }}/
|
||||
template:
|
||||
src: 'unload_ck.sh.j2'
|
||||
dest: '{{ install_path }}/unload_ck.sh'
|
||||
force: true
|
||||
mode: 0755
|
||||
when: check_out.stdout >= '1'
|
||||
- name: unload kafka
|
||||
shell: cd {{ install_path }} && sh unload_ck.sh
|
||||
when: check_out.stdout >= '1'
|
||||
- name: Ansible delete {{ install_path }}/unload_ck.sh
|
||||
file:
|
||||
path: "{{ install_path }}/unload_ck.sh"
|
||||
state: absent
|
||||
- name: Check if the Clickhouse service already exists
|
||||
shell: rpm -qa | grep clickhouse | wc -l
|
||||
register: check_out
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "卸载失败,组件可能非本安装部署,请手动卸载后继续安装"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: check_out.stdout >= '1'
|
||||
when: (allowed_unload) == "yes"
|
||||
|
||||
- block:
|
||||
- name: Check if the Clickhouse service already exists
|
||||
shell: rpm -qa | grep clickhouse | wc -l
|
||||
register: check_out
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "检测到目标集群内已有Clickhouse请检查IP是否正确或停止/卸载已启动的组件"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: check_out.stdout >= '1'
|
||||
when: (allowed_unload) == "no"
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181"
|
||||
when: '(groups.zookeeper|length) == 3'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181,{{groups.zookeeper[3]}}:2181,{{groups.zookeeper[4]}}:2181"
|
||||
when: '(groups.zookeeper|length) >= 5'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: create clickhouse package path:{{ install_path }}/clickhouse
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}/clickhouse'
|
||||
|
||||
- name: create clickhouse rpm path:{{ install_path }}/clickhouse/rpm
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}/clickhouse/rpm'
|
||||
|
||||
- name: create clickhouse rpm path:{{ install_path }}/clickhouse/logs
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}/clickhouse/logs'
|
||||
|
||||
- name: create clickhouse rpm path:{{ install_path }}/clickhouse-exporter
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}/clickhouse-exporter'
|
||||
|
||||
- name: create clickhouse server path:{{ install_path }}/clickhouse/clickhouse-server
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}/clickhouse/clickhouse-server'
|
||||
|
||||
#复制tar到目标服务器
|
||||
- name: copy rpm files to {{ install_path }}/clickhouse/rpm/
|
||||
copy:
|
||||
src: '{{ package_path }}/clickhouse/{{ item.file }}'
|
||||
dest: '{{ install_path }}/clickhouse/rpm/'
|
||||
force: true
|
||||
with_items:
|
||||
- { file: 'clickhouse-client-{{ clickhouse_version }}-1.el7.x86_64.rpm' }
|
||||
- { file: 'clickhouse-common-static-{{ clickhouse_version }}-1.el7.x86_64.rpm' }
|
||||
- { file: 'clickhouse-server-{{ clickhouse_version }}-1.el7.x86_64.rpm' }
|
||||
- { file: 'clickhouse-server-common-{{ clickhouse_version }}-1.el7.x86_64.rpm' }
|
||||
- { file: 'unixODBC-2.3.1-11.el7.x86_64.rpm' }
|
||||
|
||||
- name: get readonly key sha256
|
||||
shell: echo -n "{{ readonly_key }}"|sha256sum | tr -d '-' | sed -e 's/^[ ]*//g' | sed -e 's/[ ]*$//g'
|
||||
register: readonly_key_out
|
||||
|
||||
- name: readonly_key_sha to ansible variable
|
||||
set_fact: readonly_key_sha="{{readonly_key_out.stdout}}"
|
||||
|
||||
- name: get root key sha256
|
||||
shell: echo -n "{{ root_key }}"|sha256sum| tr -d '-' | sed -e 's/^[ ]*//g' | sed -e 's/[ ]*$//g'
|
||||
register: root_key_out
|
||||
|
||||
- name: root_key_sha to ansible variable
|
||||
set_fact: root_key_sha="{{root_key_out.stdout}}"
|
||||
|
||||
#拷贝clickhouse 配置文件
|
||||
- name: copy clickhouse config files to {{ install_path }}/clickhouse/clickhouse-server/
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
force: true
|
||||
with_items:
|
||||
- { src: 'clickhouse-server.j2', dest: '{{ install_path }}/clickhouse/clickhouse-server/clickhouse-server' }
|
||||
- { src: 'set_zk_node.sh.j2', dest: '{{ install_path }}/clickhouse/clickhouse-server/set_zk_node.sh' }
|
||||
- { src: 'clickhouse-server.j2', dest: '/etc/init.d/clickhouse-server' }
|
||||
- { src: 'ckquery_list.j2', dest: '{{ install_path }}/clickhouse/clickhouse-server/ckquery_list' }
|
||||
- { src: 'ckdata_list.j2', dest: '{{ install_path }}/clickhouse/clickhouse-server/ckdata_list' }
|
||||
|
||||
#拷贝clickhouse 配置文件
|
||||
- name: copy clickhouse config files to {{ install_path }}/clickhouse/clickhouse-server/
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
force: true
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'config.xml.j2', dest: '{{ install_path }}/clickhouse/clickhouse-server/config.xml' }
|
||||
- { src: 'users.xml.j2', dest: '{{ install_path }}/clickhouse/clickhouse-server/users.xml' }
|
||||
|
||||
- name: check unixODBC
|
||||
shell: rpm -qa | grep "unixODBC-2.3.1-11.el7.x86_64" | wc -l
|
||||
register: odbc_install
|
||||
|
||||
- name: install unixODBC
|
||||
shell: rpm -ivh {{ install_path }}/clickhouse/rpm/unixODBC-2.3.1-11.el7.x86_64.rpm
|
||||
when: odbc_install.stdout == '0'
|
||||
|
||||
- name: copy clickhouse-exporter.tar to {{ install_path }}/clickhouse-exporter/
|
||||
copy:
|
||||
src: '{{ package_path }}/clickhouse/clickhouse-exporter.tar'
|
||||
dest: '{{ install_path }}/clickhouse-exporter/'
|
||||
force: true
|
||||
|
||||
- name: copy start_exporter.sh to {{ install_path }}/clickhouse-exporter/
|
||||
template:
|
||||
src: 'start_exporter.sh.j2'
|
||||
dest: '{{ install_path }}/clickhouse-exporter/start_exporter.sh'
|
||||
force: true
|
||||
mode: 0755
|
||||
|
||||
#导入exporter镜像
|
||||
- name: load clickhouse-expoter
|
||||
docker_image:
|
||||
name: 'clickhouse-exporter'
|
||||
tag: 'v1.0'
|
||||
load_path: '{{ install_path }}/clickhouse-exporter/clickhouse-exporter.tar'
|
||||
source: load
|
||||
force_tag: yes
|
||||
force_source: yes
|
||||
|
||||
#启动exporter
|
||||
- name: start clickhouse_exporter
|
||||
shell: cd {{ install_path }}/clickhouse-exporter/ && ./start_exporter.sh
|
||||
@@ -0,0 +1 @@
|
||||
- include: install_clickhouse.yml
|
||||
@@ -0,0 +1,5 @@
|
||||
{% for ip in ansible_play_hosts %}
|
||||
{% if (groups.clickhouse[0]) != ip and (groups.clickhouse[1]) != ip%}
|
||||
{{ip}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{ groups.clickhouse[0] }}
|
||||
{{ groups.clickhouse[1] }}
|
||||
355
parcels/roles/components/clickhouse/common/templates/clickhouse-server.j2
Executable file
355
parcels/roles/components/clickhouse/common/templates/clickhouse-server.j2
Executable file
@@ -0,0 +1,355 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: clickhouse-server
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Short-Description: Yandex clickhouse-server daemon
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
CLICKHOUSE_USER=clickhouse
|
||||
CLICKHOUSE_GROUP=${CLICKHOUSE_USER}
|
||||
SHELL=/bin/bash
|
||||
PROGRAM=clickhouse-server
|
||||
GENERIC_PROGRAM=clickhouse
|
||||
EXTRACT_FROM_CONFIG=${GENERIC_PROGRAM}-extract-from-config
|
||||
SYSCONFDIR={{ install_path }}/clickhouse/$PROGRAM
|
||||
CLICKHOUSE_LOGDIR={{ install_path }}/clickhouse/clickhouse-server
|
||||
CLICKHOUSE_LOGDIR_USER=root
|
||||
CLICKHOUSE_DATADIR_OLD={{ install_path }}/clickhouse/clickhouse_old
|
||||
LOCALSTATEDIR=/var/lock
|
||||
BINDIR=/usr/bin
|
||||
CLICKHOUSE_CRONFILE=/etc/cron.d/clickhouse-server
|
||||
CLICKHOUSE_CONFIG={{ install_path }}/clickhouse/clickhouse-server/config.xml
|
||||
LOCKFILE=$LOCALSTATEDIR/$PROGRAM
|
||||
RETVAL=0
|
||||
CLICKHOUSE_PIDDIR={{ install_path }}/clickhouse/$PROGRAM
|
||||
CLICKHOUSE_PIDFILE="$CLICKHOUSE_PIDDIR/$PROGRAM.pid"
|
||||
|
||||
# Some systems lack "flock"
|
||||
command -v flock >/dev/null && FLOCK=flock
|
||||
|
||||
|
||||
# Override defaults from optional config file
|
||||
test -f /etc/default/clickhouse && . /etc/default/clickhouse
|
||||
|
||||
# On x86_64, check for required instruction set.
|
||||
if uname -mpi | grep -q 'x86_64'; then
|
||||
if ! grep -q 'sse4_2' /proc/cpuinfo; then
|
||||
# On KVM, cpuinfo could falsely not report SSE 4.2 support, so skip the check.
|
||||
if ! grep -q 'Common KVM processor' /proc/cpuinfo; then
|
||||
|
||||
# Some other VMs also report wrong flags in cpuinfo.
|
||||
# Tricky way to test for instruction set:
|
||||
# create temporary binary and run it;
|
||||
# if it get caught illegal instruction signal,
|
||||
# then required instruction set is not supported really.
|
||||
#
|
||||
# Generated this way:
|
||||
# gcc -xc -Os -static -nostdlib - <<< 'void _start() { __asm__("pcmpgtq %%xmm0, %%xmm1; mov $0x3c, %%rax; xor %%rdi, %%rdi; syscall":::"memory"); }' && strip -R .note.gnu.build-id -R .comment -R .eh_frame -s ./a.out && gzip -c -9 ./a.out | base64 -w0; echo
|
||||
|
||||
if ! (echo -n 'H4sICAwAW1cCA2Eub3V0AKt39XFjYmRkgAEmBjsGEI+H0QHMd4CKGyCUAMUsGJiBJDNQNUiYlQEZOKDQclB9cnD9CmCSBYqJBRxQOvBpSQobGfqIAWn8FuYnPI4fsAGyPQz/87MeZtArziguKSpJTGLQK0mtKGGgGHADMSgoYH6AhTMPNHyE0NQzYuEzYzEXFr6CBPQDANAsXKTwAQAA' | base64 -d | gzip -d > /tmp/clickhouse_test_sse42 && chmod a+x /tmp/clickhouse_test_sse42 && /tmp/clickhouse_test_sse42); then
|
||||
echo 'Warning! SSE 4.2 instruction set is not supported'
|
||||
#exit 3
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
SUPPORTED_COMMANDS="{start|stop|status|restart|forcestop|forcerestart|reload|condstart|condstop|condrestart|condreload|initdb}"
|
||||
is_supported_command()
|
||||
{
|
||||
echo "$SUPPORTED_COMMANDS" | grep -E "(\{|\|)$1(\||})" &> /dev/null
|
||||
}
|
||||
|
||||
|
||||
is_running()
|
||||
{
|
||||
[ -r "$CLICKHOUSE_PIDFILE" ] && pgrep -s $(cat "$CLICKHOUSE_PIDFILE") 1> /dev/null 2> /dev/null
|
||||
}
|
||||
|
||||
|
||||
wait_for_done()
|
||||
{
|
||||
while is_running; do
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
die()
|
||||
{
|
||||
echo $1 >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Check that configuration file is Ok.
|
||||
check_config()
|
||||
{
|
||||
if [ -x "$BINDIR/$EXTRACT_FROM_CONFIG" ]; then
|
||||
su -s $SHELL ${CLICKHOUSE_USER} -c "$BINDIR/$EXTRACT_FROM_CONFIG --config-file=\"$CLICKHOUSE_CONFIG\" --key=path" >/dev/null || die "Configuration file ${CLICKHOUSE_CONFIG} doesn't parse successfully. Won't restart server. You may use forcerestart if you are sure.";
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
initdb()
|
||||
{
|
||||
if [ -d ${SYSCONFDIR} ]; then
|
||||
su -s /bin/sh ${CLICKHOUSE_USER} -c "test -w ${SYSCONFDIR}" || chown ${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP} ${SYSCONFDIR}
|
||||
fi
|
||||
|
||||
if [ -x "$BINDIR/$EXTRACT_FROM_CONFIG" ]; then
|
||||
CLICKHOUSE_DATADIR_FROM_CONFIG=$(su -s $SHELL ${CLICKHOUSE_USER} -c "$BINDIR/$EXTRACT_FROM_CONFIG --config-file=\"$CLICKHOUSE_CONFIG\" --key=path")
|
||||
if [ "(" "$?" -ne "0" ")" -o "(" -z "${CLICKHOUSE_DATADIR_FROM_CONFIG}" ")" ]; then
|
||||
die "Cannot obtain value of path from config file: ${CLICKHOUSE_CONFIG}";
|
||||
fi
|
||||
echo "Path to data directory in ${CLICKHOUSE_CONFIG}: ${CLICKHOUSE_DATADIR_FROM_CONFIG}"
|
||||
else
|
||||
CLICKHOUSE_DATADIR_FROM_CONFIG="/var/lib/clickhouse"
|
||||
fi
|
||||
|
||||
if ! getent group ${CLICKHOUSE_USER} >/dev/null; then
|
||||
echo "Can't chown to non-existing user ${CLICKHOUSE_USER}"
|
||||
return
|
||||
fi
|
||||
if ! getent passwd ${CLICKHOUSE_GROUP} >/dev/null; then
|
||||
echo "Can't chown to non-existing group ${CLICKHOUSE_GROUP}"
|
||||
return
|
||||
fi
|
||||
|
||||
if ! $(su -s $SHELL ${CLICKHOUSE_USER} -c "test -r ${CLICKHOUSE_CONFIG}"); then
|
||||
echo "Warning! clickhouse config [${CLICKHOUSE_CONFIG}] not readable by user [${CLICKHOUSE_USER}]"
|
||||
fi
|
||||
|
||||
if ! $(su -s $SHELL ${CLICKHOUSE_USER} -c "test -O \"${CLICKHOUSE_DATADIR_FROM_CONFIG}\" && test -G \"${CLICKHOUSE_DATADIR_FROM_CONFIG}\""); then
|
||||
if [ $(dirname "${CLICKHOUSE_DATADIR_FROM_CONFIG}") == "/" ]; then
|
||||
echo "Directory ${CLICKHOUSE_DATADIR_FROM_CONFIG} seems too dangerous to chown."
|
||||
else
|
||||
if [ ! -e "${CLICKHOUSE_DATADIR_FROM_CONFIG}" ]; then
|
||||
echo "Creating directory ${CLICKHOUSE_DATADIR_FROM_CONFIG}"
|
||||
mkdir -p "${CLICKHOUSE_DATADIR_FROM_CONFIG}"
|
||||
fi
|
||||
|
||||
echo "Changing owner of [${CLICKHOUSE_DATADIR_FROM_CONFIG}] to [${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP}]"
|
||||
chown -R ${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP} "${CLICKHOUSE_DATADIR_FROM_CONFIG}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! $(su -s $SHELL ${CLICKHOUSE_USER} -c "test -w ${CLICKHOUSE_LOGDIR}"); then
|
||||
echo "Changing owner of [${CLICKHOUSE_LOGDIR}/*] to [${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP}]"
|
||||
chown -R ${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP} ${CLICKHOUSE_LOGDIR}/*
|
||||
echo "Changing owner of [${CLICKHOUSE_LOGDIR}] to [${CLICKHOUSE_LOGDIR_USER}:${CLICKHOUSE_GROUP}]"
|
||||
chown ${CLICKHOUSE_LOGDIR_USER}:${CLICKHOUSE_GROUP} ${CLICKHOUSE_LOGDIR}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
[ -x $BINDIR/$PROGRAM ] || exit 0
|
||||
local EXIT_STATUS
|
||||
EXIT_STATUS=0
|
||||
|
||||
echo -n "Start $PROGRAM service: "
|
||||
|
||||
if is_running; then
|
||||
echo -n "already running "
|
||||
EXIT_STATUS=1
|
||||
else
|
||||
ulimit -n 262144
|
||||
mkdir -p $CLICKHOUSE_PIDDIR
|
||||
chown -R $CLICKHOUSE_USER:$CLICKHOUSE_GROUP $CLICKHOUSE_PIDDIR
|
||||
initdb
|
||||
if ! is_running; then
|
||||
# Lock should not be held while running child process, so we release the lock. Note: obviously, there is race condition.
|
||||
# But clickhouse-server has protection from simultaneous runs with same data directory.
|
||||
su -s $SHELL ${CLICKHOUSE_USER} -c "$FLOCK -u 9; exec -a \"$PROGRAM\" \"$BINDIR/$PROGRAM\" --daemon --pid-file=\"$CLICKHOUSE_PIDFILE\" --config-file=\"$CLICKHOUSE_CONFIG\""
|
||||
EXIT_STATUS=$?
|
||||
if [ $EXIT_STATUS -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $EXIT_STATUS -eq 0 ]; then
|
||||
echo "DONE"
|
||||
else
|
||||
echo "FAILED"
|
||||
fi
|
||||
|
||||
return $EXIT_STATUS
|
||||
}
|
||||
|
||||
|
||||
stop()
|
||||
{
|
||||
local EXIT_STATUS
|
||||
EXIT_STATUS=0
|
||||
|
||||
if [ -f $CLICKHOUSE_PIDFILE ]; then
|
||||
|
||||
echo -n "Stop $PROGRAM service: "
|
||||
|
||||
kill -TERM $(cat "$CLICKHOUSE_PIDFILE")
|
||||
|
||||
wait_for_done
|
||||
|
||||
echo "DONE"
|
||||
fi
|
||||
return $EXIT_STATUS
|
||||
}
|
||||
|
||||
|
||||
restart()
|
||||
{
|
||||
check_config
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
|
||||
forcestop()
|
||||
{
|
||||
local EXIT_STATUS
|
||||
EXIT_STATUS=0
|
||||
|
||||
echo -n "Stop forcefully $PROGRAM service: "
|
||||
|
||||
kill -KILL $(cat "$CLICKHOUSE_PIDFILE")
|
||||
|
||||
wait_for_done
|
||||
|
||||
echo "DONE"
|
||||
return $EXIT_STATUS
|
||||
}
|
||||
|
||||
|
||||
forcerestart()
|
||||
{
|
||||
forcestop
|
||||
start
|
||||
}
|
||||
|
||||
use_cron()
|
||||
{
|
||||
# 1. running systemd
|
||||
if [ -x "/bin/systemctl" ] && [ -f /etc/systemd/system/clickhouse-server.service ] && [ -d /run/systemd/system ]; then
|
||||
return 1
|
||||
fi
|
||||
# 2. disabled by config
|
||||
if [ -z "$CLICKHOUSE_CRONFILE" ]; then
|
||||
return 2
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
enable_cron()
|
||||
{
|
||||
use_cron && sed -i 's/^#*//' "$CLICKHOUSE_CRONFILE"
|
||||
}
|
||||
|
||||
|
||||
disable_cron()
|
||||
{
|
||||
use_cron && sed -i 's/^#*/#/' "$CLICKHOUSE_CRONFILE"
|
||||
}
|
||||
|
||||
|
||||
is_cron_disabled()
|
||||
{
|
||||
use_cron || return 0
|
||||
|
||||
# Assumes that either no lines are commented or all lines are commented.
|
||||
# Also please note, that currently cron file for ClickHouse has only one line (but some time ago there was more).
|
||||
grep -q -E '^#' "$CLICKHOUSE_CRONFILE";
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
# See how we were called.
|
||||
EXIT_STATUS=0
|
||||
case "$1" in
|
||||
start)
|
||||
start && enable_cron
|
||||
;;
|
||||
stop)
|
||||
disable_cron && stop
|
||||
;;
|
||||
restart)
|
||||
restart && enable_cron
|
||||
;;
|
||||
forcestop)
|
||||
disable_cron && forcestop
|
||||
;;
|
||||
forcerestart)
|
||||
forcerestart && enable_cron
|
||||
;;
|
||||
reload)
|
||||
restart
|
||||
;;
|
||||
condstart)
|
||||
is_running || start
|
||||
;;
|
||||
condstop)
|
||||
is_running && stop
|
||||
;;
|
||||
condrestart)
|
||||
is_running && restart
|
||||
;;
|
||||
condreload)
|
||||
is_running && restart
|
||||
;;
|
||||
initdb)
|
||||
initdb
|
||||
;;
|
||||
enable_cron)
|
||||
enable_cron
|
||||
;;
|
||||
disable_cron)
|
||||
disable_cron
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 $SUPPORTED_COMMANDS"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $EXIT_STATUS
|
||||
}
|
||||
|
||||
|
||||
status()
|
||||
{
|
||||
if is_running; then
|
||||
echo "$PROGRAM service is running"
|
||||
else
|
||||
if is_cron_disabled; then
|
||||
echo "$PROGRAM service is stopped";
|
||||
else
|
||||
echo "$PROGRAM: process unexpectedly terminated"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Running commands without need of locking
|
||||
case "$1" in
|
||||
status)
|
||||
status
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
(
|
||||
if $FLOCK -n 9; then
|
||||
main "$@"
|
||||
else
|
||||
echo "Init script is already running" && exit 1
|
||||
fi
|
||||
) 9> $LOCKFILE
|
||||
@@ -0,0 +1,373 @@
|
||||
<?xml version="1.0"?>
|
||||
<yandex>
|
||||
<logger>
|
||||
<!-- Possible levels: https://github.com/pocoproject/poco/blob/develop/Foundation/include/Poco/Logger.h#L105 -->
|
||||
<level>error</level>
|
||||
<log>{{ install_path }}/clickhouse/logs/clickhouse-server.log</log>
|
||||
<errorlog>{{ install_path }}/clickhouse/logs/clickhouse-server.err.log</errorlog>
|
||||
<size>200M</size>
|
||||
<count>10</count>
|
||||
<!-- <console>1</console> --> <!-- Default behavior is autodetection (log to console if not daemon mode and is tty) -->
|
||||
</logger>
|
||||
<!--display_name>production</display_name--> <!-- It is the name that will be shown in the client -->
|
||||
<http_port>8123</http_port>
|
||||
<tcp_port>9001</tcp_port>
|
||||
|
||||
<!-- For HTTPS and SSL over native protocol. -->
|
||||
<!--
|
||||
<https_port>8443</https_port>
|
||||
<tcp_port_secure>9440</tcp_port_secure>
|
||||
-->
|
||||
|
||||
<!-- Used with https_port and tcp_port_secure. Full ssl options list: https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h#L71 -->
|
||||
<openSSL>
|
||||
<server> <!-- Used for https server AND secure tcp port -->
|
||||
<!-- openssl req -subj "/CN=localhost" -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/clickhouse-server/server.key -out /etc/clickhouse-server/server.crt -->
|
||||
<certificateFile>{{ install_path }}/clickhouse/clickhouse-server/server.crt</certificateFile>
|
||||
<privateKeyFile>{{ install_path }}/clickhouse/clickhouse-server/server.key</privateKeyFile>
|
||||
<!-- openssl dhparam -out /etc/clickhouse-server/dhparam.pem 4096 -->
|
||||
<dhParamsFile>{{ install_path }}/clickhouse/clickhouse-server/dhparam.pem</dhParamsFile>
|
||||
<verificationMode>none</verificationMode>
|
||||
<loadDefaultCAFile>true</loadDefaultCAFile>
|
||||
<cacheSessions>true</cacheSessions>
|
||||
<disableProtocols>sslv2,sslv3</disableProtocols>
|
||||
<preferServerCiphers>true</preferServerCiphers>
|
||||
</server>
|
||||
|
||||
<client> <!-- Used for connecting to https dictionary source -->
|
||||
<loadDefaultCAFile>true</loadDefaultCAFile>
|
||||
<cacheSessions>true</cacheSessions>
|
||||
<disableProtocols>sslv2,sslv3</disableProtocols>
|
||||
<preferServerCiphers>true</preferServerCiphers>
|
||||
<!-- Use for self-signed: <verificationMode>none</verificationMode> -->
|
||||
<invalidCertificateHandler>
|
||||
<!-- Use for self-signed: <name>AcceptCertificateHandler</name> -->
|
||||
<name>RejectCertificateHandler</name>
|
||||
</invalidCertificateHandler>
|
||||
</client>
|
||||
</openSSL>
|
||||
|
||||
<!-- Default root page on http[s] server. For example load UI from https://tabix.io/ when opening http://localhost:8123 -->
|
||||
<!--
|
||||
<http_server_default_response><![CDATA[<html ng-app="SMI2"><head><base href="http://ui.tabix.io/"></head><body><div ui-view="" class="content-ui"></div><script src="http://loader.tabix.io/master.js"></script></body></html>]]></http_server_default_response>
|
||||
-->
|
||||
|
||||
<!-- Port for communication between replicas. Used for data exchange. -->
|
||||
<interserver_http_port>9009</interserver_http_port>
|
||||
|
||||
<!-- Hostname that is used by other replicas to request this server.
|
||||
If not specified, than it is determined analoguous to 'hostname -f' command.
|
||||
This setting could be used to switch replication to another network interface.
|
||||
-->
|
||||
|
||||
<interserver_http_host>{{ inventory_hostname }}</interserver_http_host>
|
||||
|
||||
|
||||
<!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. -->
|
||||
<listen_host>0.0.0.0</listen_host>
|
||||
<!-- Same for hosts with disabled ipv6: -->
|
||||
<!--<listen_host>0.0.0.0</listen_host>-->
|
||||
|
||||
<!-- Default values - try listen localhost on ipv4 and ipv6: -->
|
||||
|
||||
<!--<listen_host>::1</listen_host>-->
|
||||
<!-- <listen_host>127.0.0.1</listen_host>-->
|
||||
|
||||
<!-- Don't exit if ipv6 or ipv4 unavailable, but listen_host with this protocol specified -->
|
||||
<!-- <listen_try>0</listen_try>-->
|
||||
|
||||
<!-- Allow listen on same address:port -->
|
||||
<!-- <listen_reuse_port>0</listen_reuse_port>-->
|
||||
|
||||
<listen_backlog>64</listen_backlog>
|
||||
|
||||
<max_connections>4096</max_connections>
|
||||
<keep_alive_timeout>600</keep_alive_timeout>
|
||||
|
||||
<!-- Maximum number of concurrent queries. -->
|
||||
<max_concurrent_queries>150</max_concurrent_queries>
|
||||
|
||||
<!-- Set limit on number of open files (default: maximum). This setting makes sense on Mac OS X because getrlimit() fails to retrieve
|
||||
correct maximum value. -->
|
||||
<!-- <max_open_files>262144</max_open_files> -->
|
||||
|
||||
<!-- Size of cache of uncompressed blocks of data, used in tables of MergeTree family.
|
||||
In bytes. Cache is single for server. Memory is allocated only on demand.
|
||||
Cache is used when 'use_uncompressed_cache' user setting turned on (off by default).
|
||||
Uncompressed cache is advantageous only for very short queries and in rare cases.
|
||||
-->
|
||||
<uncompressed_cache_size>8589934592</uncompressed_cache_size>
|
||||
|
||||
<!-- Approximate size of mark cache, used in tables of MergeTree family.
|
||||
In bytes. Cache is single for server. Memory is allocated only on demand.
|
||||
You should not lower this value.
|
||||
-->
|
||||
<mark_cache_size>5368709120</mark_cache_size>
|
||||
|
||||
|
||||
<!-- Path to data directory, with trailing slash. -->
|
||||
<path>{{ data_path }}/clickhouse/</path>
|
||||
|
||||
<!-- Path to temporary data for processing hard queries. -->
|
||||
<tmp_path>{{ data_path }}/clickhouse/tmp/</tmp_path>
|
||||
|
||||
<!-- Directory with user provided files that are accessible by 'file' table function. -->
|
||||
<user_files_path>{{ install_path }}/clickhouse/user_files/</user_files_path>
|
||||
|
||||
<!-- Path to configuration file with users, access rights, profiles of settings, quotas. -->
|
||||
<users_config>users.xml</users_config>
|
||||
|
||||
<!-- Default profile of settings. -->
|
||||
<default_profile>default</default_profile>
|
||||
|
||||
<!-- System profile of settings. This settings are used by internal processes (Buffer storage, Distibuted DDL worker and so on). -->
|
||||
<!-- <system_profile>default</system_profile> -->
|
||||
|
||||
<!-- Default database. -->
|
||||
<default_database>{{ default_database }}</default_database>
|
||||
|
||||
<!-- Server time zone could be set here.
|
||||
|
||||
Time zone is used when converting between String and DateTime types,
|
||||
when printing DateTime in text formats and parsing DateTime from text,
|
||||
it is used in date and time related functions, if specific time zone was not passed as an argument.
|
||||
|
||||
Time zone is specified as identifier from IANA time zone database, like UTC or Africa/Abidjan.
|
||||
If not specified, system time zone at server startup is used.
|
||||
|
||||
Please note, that server could display time zone alias instead of specified name.
|
||||
Example: W-SU is an alias for Europe/Moscow and Zulu is an alias for UTC.
|
||||
-->
|
||||
<!-- <timezone>Europe/Moscow</timezone> -->
|
||||
|
||||
<!-- You can specify umask here (see "man umask"). Server will apply it on startup.
|
||||
Number is always parsed as octal. Default umask is 027 (other users cannot read logs, data files, etc; group can only read).
|
||||
-->
|
||||
<!-- <umask>022</umask> -->
|
||||
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/docs/en/table_engines/distributed/
|
||||
-->
|
||||
<remote_servers incl="clickhouse_remote_servers" >
|
||||
<!-- Test only shard config for testing distributed storage
|
||||
<test_shard_localhost>
|
||||
<shard>
|
||||
<replica>
|
||||
<host>localhost</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</test_shard_localhost>
|
||||
<test_shard_localhost_secure>
|
||||
<shard>
|
||||
<replica>
|
||||
<host>localhost</host>
|
||||
<port>9440</port>
|
||||
<secure>1</secure>
|
||||
</replica>
|
||||
</shard>
|
||||
</test_shard_localhost_secure>-->
|
||||
</remote_servers>
|
||||
|
||||
|
||||
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
|
||||
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.
|
||||
Values for substitutions are specified in /yandex:wq
|
||||
/name_of_substitution elements in that file.
|
||||
-->
|
||||
|
||||
<!-- ZooKeeper is used to store metadata about replicas, when using Replicated tables.
|
||||
Optional. If you don't use replicated tables, you could omit that.
|
||||
|
||||
See https://clickhouse.yandex/docs/en/table_engines/replication/
|
||||
-->
|
||||
<zookeeper incl="zookeeper-servers" optional="true" />
|
||||
|
||||
<!-- Substitutions for parameters of replicated tables.
|
||||
Optional. If you don't use replicated tables, you could omit that.
|
||||
|
||||
See https://clickhouse.yandex/docs/en/table_engines/replication/#creating-replicated-tables
|
||||
-->
|
||||
<macros incl="macros" optional="true" />
|
||||
|
||||
|
||||
<!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->
|
||||
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
|
||||
|
||||
|
||||
<!-- Maximum session timeout, in seconds. Default: 3600. -->
|
||||
<max_session_timeout>21600</max_session_timeout>
|
||||
|
||||
<!-- Default session timeout, in seconds. Default: 60. -->
|
||||
<default_session_timeout>6000</default_session_timeout>
|
||||
<max_table_size_to_drop>0</max_table_size_to_drop>
|
||||
<max_partition_size_to_drop>0</max_partition_size_to_drop>
|
||||
<include_from>{{ install_path }}/clickhouse/clickhouse-server/metrika.xml</include_from>
|
||||
<!-- Sending data to Graphite for monitoring. Several sections can be defined. -->
|
||||
<!--
|
||||
interval - send every X second
|
||||
root_path - prefix for keys
|
||||
hostname_in_path - append hostname to root_path (default = true)
|
||||
metrics - send data from table system.metrics
|
||||
events - send data from table system.events
|
||||
asynchronous_metrics - send data from table system.asynchronous_metrics
|
||||
-->
|
||||
<!--
|
||||
<graphite>
|
||||
<host>localhost</host>
|
||||
<port>42000</port>
|
||||
<timeout>0.1</timeout>
|
||||
<interval>60</interval>
|
||||
<root_path>one_min</root_path>
|
||||
<hostname_in_path>true</hostname_in_path>
|
||||
|
||||
<metrics>true</metrics>
|
||||
<events>true</events>
|
||||
<asynchronous_metrics>true</asynchronous_metrics>
|
||||
</graphite>
|
||||
<graphite>
|
||||
<host>localhost</host>
|
||||
<port>42000</port>
|
||||
<timeout>0.1</timeout>
|
||||
<interval>1</interval>
|
||||
<root_path>one_sec</root_path>
|
||||
|
||||
<metrics>true</metrics>
|
||||
<events>true</events>
|
||||
<asynchronous_metrics>false</asynchronous_metrics>
|
||||
</graphite>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Query log. Used only for queries with setting log_queries = 1. -->
|
||||
<query_log>
|
||||
<!-- What table to insert data. If table is not exist, it will be created.
|
||||
When query log structure is changed after system update,
|
||||
then old table will be renamed and new table will be created automatically.
|
||||
-->
|
||||
<database>system</database>
|
||||
<table>query_log</table>
|
||||
<!--
|
||||
PARTITION BY expr https://clickhouse.yandex/docs/en/table_engines/custom_partitioning_key/
|
||||
Example:
|
||||
event_date
|
||||
toMonday(event_date)
|
||||
toYYYYMM(event_date)
|
||||
toStartOfHour(event_time)
|
||||
-->
|
||||
<partition_by>toYYYYMM(event_date)</partition_by>
|
||||
<!-- Interval of flushing data. -->
|
||||
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
|
||||
</query_log>
|
||||
|
||||
|
||||
<!-- Uncomment if use part_log
|
||||
<part_log>
|
||||
<database>system</database>
|
||||
<table>part_log</table>
|
||||
|
||||
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
|
||||
</part_log>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Parameters for embedded dictionaries, used in Yandex.Metrica.
|
||||
See https://clickhouse.yandex/docs/en/dicts/internal_dicts/
|
||||
-->
|
||||
|
||||
<!-- Path to file with region hierarchy. -->
|
||||
<!-- <path_to_regions_hierarchy_file>/opt/geo/regions_hierarchy.txt</path_to_regions_hierarchy_file> -->
|
||||
|
||||
<!-- Path to directory with files containing names of regions -->
|
||||
<!-- <path_to_regions_names_files>/opt/geo/</path_to_regions_names_files> -->
|
||||
|
||||
|
||||
<!-- Configuration of external dictionaries. See:
|
||||
https://clickhouse.yandex/docs/en/dicts/external_dicts/
|
||||
-->
|
||||
<dictionaries_config>*_dictionary.xml</dictionaries_config>
|
||||
|
||||
<!-- Uncomment if you want data to be compressed 30-100% better.
|
||||
Don't do that if you just started using ClickHouse.
|
||||
-->
|
||||
<compression incl="clickhouse_compression">
|
||||
<!--
|
||||
<!- - Set of variants. Checked in order. Last matching case wins. If nothing matches, lz4 will be used. - ->
|
||||
<case>
|
||||
|
||||
<!- - Conditions. All must be satisfied. Some conditions may be omitted. - ->
|
||||
<min_part_size>10000000000</min_part_size> <!- - Min part size in bytes. - ->
|
||||
<min_part_size_ratio>0.01</min_part_size_ratio> <!- - Min size of part relative to whole table size. - ->
|
||||
|
||||
<!- - What compression method to use. - ->
|
||||
<method>zstd</method>
|
||||
</case>
|
||||
-->
|
||||
</compression>
|
||||
|
||||
<!-- Allow to execute distributed DDL queries (CREATE, DROP, ALTER, RENAME) on cluster.
|
||||
Works only if ZooKeeper is enabled. Comment it if such functionality isn't required. -->
|
||||
<distributed_ddl>
|
||||
<!-- Path in ZooKeeper to queue with DDL queries -->
|
||||
<path>/clickhouse/task_queue/ddl</path>
|
||||
|
||||
<!-- Settings from this profile will be used to execute DDL queries -->
|
||||
<!-- <profile>default</profile> -->
|
||||
</distributed_ddl>
|
||||
|
||||
<!-- Settings to fine tune MergeTree tables. See documentation in source code, in MergeTreeSettings.h -->
|
||||
<!--
|
||||
<merge_tree>
|
||||
<max_suspicious_broken_parts>5</max_suspicious_broken_parts>
|
||||
</merge_tree>
|
||||
-->
|
||||
|
||||
<!-- Protection from accidental DROP.
|
||||
If size of a MergeTree table is greater than max_table_size_to_drop (in bytes) than table could not be dropped with any DROP query.
|
||||
If you want do delete one table and don't want to restart clickhouse-server, you could create special file <clickhouse-path>/flags/force_drop_table and make DROP once.
|
||||
By default max_table_size_to_drop is 50GB; max_table_size_to_drop=0 allows to DROP any tables.
|
||||
The same for max_partition_size_to_drop.
|
||||
Uncomment to disable protection.
|
||||
-->
|
||||
<!-- <max_table_size_to_drop>0</max_table_size_to_drop> -->
|
||||
<!-- <max_partition_size_to_drop>0</max_partition_size_to_drop> -->
|
||||
|
||||
<!-- Example of parameters for GraphiteMergeTree table engine -->
|
||||
<graphite_rollup_example>
|
||||
<pattern>
|
||||
<regexp>click_cost</regexp>
|
||||
<function>any</function>
|
||||
<retention>
|
||||
<age>0</age>
|
||||
<precision>3600</precision>
|
||||
</retention>
|
||||
<retention>
|
||||
<age>86400</age>
|
||||
<precision>60</precision>
|
||||
</retention>
|
||||
</pattern>
|
||||
<default>
|
||||
<function>max</function>
|
||||
<retention>
|
||||
<age>0</age>
|
||||
<precision>60</precision>
|
||||
</retention>
|
||||
<retention>
|
||||
<age>3600</age>
|
||||
<precision>300</precision>
|
||||
</retention>
|
||||
<retention>
|
||||
<age>86400</age>
|
||||
<precision>3600</precision>
|
||||
</retention>
|
||||
</default>
|
||||
</graphite_rollup_example>
|
||||
|
||||
<!-- Directory in <clickhouse-path> containing schema files for various input formats.
|
||||
The directory will be created if it doesn't exist.
|
||||
-->
|
||||
<format_schema_path>{{ install_path }}/clickhouse/format_schemas/</format_schema_path>
|
||||
|
||||
<!-- Uncomment to disable ClickHouse internal DNS caching. -->
|
||||
<!-- <disable_internal_dns_cache>1</disable_internal_dns_cache> -->
|
||||
</yandex>
|
||||
23
parcels/roles/components/clickhouse/common/templates/set_zk_node.sh.j2
Executable file
23
parcels/roles/components/clickhouse/common/templates/set_zk_node.sh.j2
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
#<node index="1">
|
||||
#<host>192.168.44.33</host>
|
||||
#<port>2181</port>
|
||||
#</node>
|
||||
|
||||
zookeeper_servers={{ zookeeper_servers }}
|
||||
|
||||
start_num=`cat -n {{ install_path }}/clickhouse/clickhouse-server/metrika.xml |grep "zookeeper-servers" |awk '{print $1}'|sed -n "1"p`
|
||||
|
||||
zk_node=(${zookeeper_servers//,/ })
|
||||
|
||||
index=1
|
||||
for node in ${zk_node[@]}
|
||||
do
|
||||
ipport=(${node//:/ })
|
||||
sed -i ''$start_num'a<node index="'$index'">\n<host>'${ipport[0]}'</host>\n<port>'${ipport[1]}'</port>\n</node>\n' {{ install_path }}/clickhouse/clickhouse-server/metrika.xml
|
||||
index=`expr $index + 1`
|
||||
start_num=`expr $start_num + 5`
|
||||
done
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
#每台都要启动,修改后面clickhouse节点地址与启动服务器IP对应
|
||||
|
||||
|
||||
docker rm -f clickhouse_exporter
|
||||
|
||||
sleep 3
|
||||
|
||||
docker run -d -p 9904:9116 --name clickhouse_exporter --restart always --env CLICKHOUSE_USER=default --env CLICKHOUSE_PASSWORD=ceiec2019 clickhouse-exporter:v1.0 -scrape_uri=http://{{ inventory_hostname }}:8123/
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
source /etc/profile
|
||||
|
||||
function killService(){
|
||||
keeppath='/etc/init.d/clickhouse-server'
|
||||
if [ -x $keeppath ];then
|
||||
service clickhouse-server stop
|
||||
fi
|
||||
}
|
||||
|
||||
function killPid(){
|
||||
|
||||
livenum=`rpm -qa | grep clickhouse | wc -l`
|
||||
if [ $livenum -ne 0 ];then
|
||||
service clickhouse-server stop
|
||||
rpm -e --noscripts clickhouse-client-20.3.12.112-1.el7.x86_64
|
||||
rpm -e --noscripts clickhouse-server-20.3.12.112-1.el7.x86_64
|
||||
rpm -e --noscripts clickhouse-server-common-20.3.12.112-1.el7.x86_64
|
||||
rpm -e --noscripts clickhouse-common-static-20.3.12.112-1.el7.x86_64
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
killService
|
||||
sleep 15
|
||||
killPid
|
||||
rm -rf {{ install_path }}/clickhouse
|
||||
rm -rf {{ data_path }}/clickhouse
|
||||
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0"?>
|
||||
<yandex>
|
||||
<!-- Profiles of settings. -->
|
||||
<profiles>
|
||||
<!-- Default settings. -->
|
||||
<default>
|
||||
<!-- Maximum memory usage for processing single query, in bytes. -->
|
||||
<max_memory_usage>150000000000</max_memory_usage>
|
||||
<max_memory_usage_for_all_queries>200000000000</max_memory_usage_for_all_queries>
|
||||
<max_bytes_before_external_group_by>75000000000</max_bytes_before_external_group_by>
|
||||
<distributed_aggregation_memory_efficient>1</distributed_aggregation_memory_efficient>
|
||||
<distributed_product_mode>local</distributed_product_mode>
|
||||
<log_queries>1</log_queries>
|
||||
<cancel_http_readonly_queries_on_client_close>1</cancel_http_readonly_queries_on_client_close>
|
||||
<background_pool_size>48</background_pool_size>
|
||||
<!-- <enable_http_compression>1</enable_http_compression>-->
|
||||
<replication_alter_columns_timeout>60</replication_alter_columns_timeout>
|
||||
<skip_unavailable_shards>1</skip_unavailable_shards>
|
||||
<max_execution_time>21600</max_execution_time>
|
||||
<!-- Use cache of uncompressed blocks of data. Meaningful only for processing many of very short queries. -->
|
||||
<use_uncompressed_cache>1</use_uncompressed_cache>
|
||||
<replace_running_query>1</replace_running_query>
|
||||
<http_receive_timeout>21600</http_receive_timeout>
|
||||
<http_send_timeout>21600</http_send_timeout>
|
||||
<receive_timeout>21600</receive_timeout>
|
||||
<send_timeout>21600</send_timeout>
|
||||
<count_distinct_implementation>uniqCombined</count_distinct_implementation>
|
||||
<!-- How to choose between replicas during distributed query processing.
|
||||
random - choose random replica from set of replicas with minimum number of errors
|
||||
nearest_hostname - from set of replicas with minimum number of errors, choose replica
|
||||
with minumum number of different symbols between replica's hostname and local hostname
|
||||
(Hamming distance).
|
||||
in_order - first live replica is choosen in specified order.
|
||||
-->
|
||||
<max_rows_to_group_by>10000000</max_rows_to_group_by>
|
||||
<group_by_overflow_mode>any</group_by_overflow_mode>
|
||||
<timeout_before_checking_execution_speed>3600</timeout_before_checking_execution_speed>
|
||||
<load_balancing>in_order</load_balancing>
|
||||
</default>
|
||||
|
||||
<!-- Profile that allows only read queries. -->
|
||||
<readonly>
|
||||
<max_memory_usage>100000000000</max_memory_usage>
|
||||
<max_memory_usage_for_all_queries>200000000000</max_memory_usage_for_all_queries>
|
||||
<distributed_product_mode>local</distributed_product_mode>
|
||||
<http_receive_timeout>600</http_receive_timeout>
|
||||
<http_send_timeout>600</http_send_timeout>
|
||||
<receive_timeout>600</receive_timeout>
|
||||
<send_timeout>600</send_timeout>
|
||||
<log_queries>1</log_queries>
|
||||
<cancel_http_readonly_queries_on_client_close>1</cancel_http_readonly_queries_on_client_close>
|
||||
<background_pool_size>48</background_pool_size>
|
||||
<!-- http压缩 不影响http请求,只影响使用chproxy的客户端-->
|
||||
<enable_http_compression>1</enable_http_compression>
|
||||
<replace_running_query>1</replace_running_query>
|
||||
<replication_alter_columns_timeout>60</replication_alter_columns_timeout>
|
||||
<skip_unavailable_shards>1</skip_unavailable_shards>
|
||||
<max_execution_time>600</max_execution_time>
|
||||
<!-- Use cache of uncompressed blocks of data. Meaningful only for processing many of very short queries. -->
|
||||
<timeout_before_checking_execution_speed>600</timeout_before_checking_execution_speed>
|
||||
<use_uncompressed_cache>1</use_uncompressed_cache>
|
||||
<count_distinct_implementation>uniqCombined</count_distinct_implementation>
|
||||
<load_balancing>in_order</load_balancing>
|
||||
<distributed_aggregation_memory_efficient>1</distributed_aggregation_memory_efficient>
|
||||
<max_rows_to_group_by>10000000</max_rows_to_group_by>
|
||||
<group_by_overflow_mode>any</group_by_overflow_mode>
|
||||
<readonly>2</readonly>
|
||||
|
||||
</readonly>
|
||||
|
||||
<ckinsert>
|
||||
<max_memory_usage>100000000000</max_memory_usage>
|
||||
<max_memory_usage_for_all_queries>200000000000</max_memory_usage_for_all_queries>
|
||||
<distributed_product_mode>local</distributed_product_mode>
|
||||
<log_queries>1</log_queries>
|
||||
<background_pool_size>48</background_pool_size>
|
||||
|
||||
<replication_alter_columns_timeout>60</replication_alter_columns_timeout>
|
||||
<skip_unavailable_shards>1</skip_unavailable_shards>
|
||||
<max_execution_time>300</max_execution_time>
|
||||
<!-- Use cache of uncompressed blocks of data. Meaningful only for processing many of very short queries. -->
|
||||
<use_uncompressed_cache>0</use_uncompressed_cache>
|
||||
<timeout_before_checking_execution_speed>300</timeout_before_checking_execution_speed>
|
||||
<http_receive_timeout>300</http_receive_timeout>
|
||||
<http_send_timeout>300</http_send_timeout>
|
||||
<receive_timeout>300</receive_timeout>
|
||||
<send_timeout>300</send_timeout>
|
||||
<allow_ddl>0</allow_ddl>
|
||||
<load_balancing>random</load_balancing>
|
||||
</ckinsert>
|
||||
</profiles>
|
||||
|
||||
<!-- Users and ACL. -->
|
||||
<users>
|
||||
<!-- If user name was not specified, 'default' user is used. -->
|
||||
<default>
|
||||
<!-- Password could be specified in plaintext or in SHA256 (in hex format).
|
||||
|
||||
If you want to specify password in plaintext (not recommended), place it in 'password' element.
|
||||
Example: <password>qwerty</password>.
|
||||
Password could be empty.
|
||||
|
||||
If you want to specify SHA256, place it in 'password_sha256_hex' element.
|
||||
Example: <password_sha256_hex>65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5</password_sha256_hex>
|
||||
|
||||
How to generate decent password:
|
||||
Execute: PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'
|
||||
In first line will be password and in second - corresponding SHA256.
|
||||
-->
|
||||
<password_sha256_hex>{{ root_key_sha }}</password_sha256_hex>
|
||||
|
||||
<!-- List of networks with open access.
|
||||
|
||||
To open access from everywhere, specify:
|
||||
<ip>::/0</ip>
|
||||
|
||||
To open access only from localhost, specify:
|
||||
<ip>::1</ip>
|
||||
<ip>127.0.0.1</ip>
|
||||
|
||||
Each element of list has one of the following forms:
|
||||
<ip> IP-address or network mask. Examples: 213.180.204.3 or 10.0.0.1/8 or 10.0.0.1/255.255.255.0
|
||||
2a02:6b8::3 or 2a02:6b8::3/64 or 2a02:6b8::3/ffff:ffff:ffff:ffff::.
|
||||
<host> Hostname. Example: server01.yandex.ru.
|
||||
To check access, DNS query is performed, and all received addresses compared to peer address.
|
||||
<host_regexp> Regular expression for host names. Example, ^server\d\d-\d\d-\d\.yandex\.ru$
|
||||
To check access, DNS PTR query is performed for peer address and then regexp is applied.
|
||||
Then, for result of PTR query, another DNS query is performed and all received addresses compared to peer address.
|
||||
Strongly recommended that regexp is ends with $
|
||||
All results of DNS requests are cached till server restart.
|
||||
-->
|
||||
<networks incl="networks" replace="replace">
|
||||
<ip>::/0</ip>
|
||||
</networks>
|
||||
|
||||
<!-- Settings profile for user. -->
|
||||
<profile>default</profile>
|
||||
|
||||
<!-- Quota for user. -->
|
||||
<quota>default</quota>
|
||||
</default>
|
||||
|
||||
<tsg_report>
|
||||
<password_sha256_hex>{{ root_key_sha }}</password_sha256_hex>
|
||||
<networks incl="networks" replace="replace">
|
||||
<ip>::/0</ip>
|
||||
</networks>
|
||||
<profile>default</profile>
|
||||
<quota>default</quota>
|
||||
</tsg_report>
|
||||
|
||||
|
||||
<tsg_insert>
|
||||
<password_sha256_hex>{{ root_key_sha }}</password_sha256_hex>
|
||||
<networks incl="networks" replace="replace">
|
||||
<ip>::/0</ip>
|
||||
</networks>
|
||||
<profile>ckinsert</profile>
|
||||
<quota>default</quota>
|
||||
</tsg_insert>
|
||||
|
||||
<!-- Example of user with readonly access. -->
|
||||
<tsg_query>
|
||||
<password_sha256_hex>{{ readonly_key_sha }}</password_sha256_hex>
|
||||
<networks incl="networks" replace="replace">
|
||||
<ip>::/0</ip>
|
||||
</networks>
|
||||
<profile>readonly</profile>
|
||||
<quota>default</quota>
|
||||
</tsg_query>
|
||||
|
||||
|
||||
<!-- Example of user with readonly access. -->
|
||||
<readonly>
|
||||
<password></password>
|
||||
<networks incl="networks" replace="replace">
|
||||
<ip>::1</ip>
|
||||
<ip>127.0.0.1</ip>
|
||||
</networks>
|
||||
<profile>readonly</profile>
|
||||
<quota>default</quota>
|
||||
</readonly>
|
||||
</users>
|
||||
|
||||
<!-- Quotas. -->
|
||||
<quotas>
|
||||
<!-- Name of quota. -->
|
||||
<default>
|
||||
<!-- Limits for time interval. You could specify many intervals with different limits. -->
|
||||
<interval>
|
||||
<!-- Length of interval. -->
|
||||
<duration>3600</duration>
|
||||
<!-- No limits. Just calculate resource usage for time interval. -->
|
||||
<queries>0</queries>
|
||||
<errors>0</errors>
|
||||
<result_rows>0</result_rows>
|
||||
<read_rows>0</read_rows>
|
||||
<execution_time>0</execution_time>
|
||||
</interval>
|
||||
</default>
|
||||
</quotas>
|
||||
</yandex>
|
||||
@@ -0,0 +1,54 @@
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181"
|
||||
when: '(groups.zookeeper|length) == 3'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181,{{groups.zookeeper[3]}}:2181,{{groups.zookeeper[4]}}:2181"
|
||||
when: '(groups.zookeeper|length) >= 5'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
#拷贝clickhouse 配置文件
|
||||
- name: copy clickhouse data config files
|
||||
template:
|
||||
src: 'ck_cluster.xml.j2'
|
||||
dest: '{{ data_path }}/clickhouse/clickhouse-server/metrika.xml'
|
||||
force: true
|
||||
backup: yes
|
||||
when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: check unixODBC
|
||||
shell: rpm -qa | grep "unixODBC-2.3.1-11.el7.x86_64" | wc -l
|
||||
register: odbc_install
|
||||
# when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: set zookeeper servers to clickhouse config
|
||||
shell: cd {{ data_path }}/clickhouse/clickhouse-server/ && ./set_zk_node.sh
|
||||
when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: install clickhouse
|
||||
shell: "if [ `rpm -qa | grep {{ item.file }} | wc -l` -eq '0' ]; then rpm -ivh {{ data_path }}/clickhouse/rpm/{{ item.file }}.rpm ; fi"
|
||||
with_items:
|
||||
- { file: 'clickhouse-common-static-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-server-common-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-server-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-client-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
when: odbc_install.stdout != '0' and inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: set dir user
|
||||
shell: chown clickhouse:clickhouse -R {{ data_path }}/clickhouse/
|
||||
when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: copy clickhouse-server to /etc/init.d/
|
||||
shell: yes | cp -r {{ data_path }}/clickhouse/clickhouse-server/clickhouse-server /etc/init.d/clickhouse-server
|
||||
when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: deleted tmp file
|
||||
shell: rm -rf {{ data_path }}/clickhouse/clickhouse-server/ckquery_list {{ data_path }}/clickhouse/clickhouse-server/ckdata_list {{ data_path }}/clickhouse/clickhouse-server/set_zk_node.sh
|
||||
when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
|
||||
- name: start clickhouse
|
||||
shell: service clickhouse-server start
|
||||
when: inventory_hostname != (groups.clickhouse[0]) and inventory_hostname != (groups.clickhouse[1])
|
||||
1
parcels/roles/components/clickhouse/data/tasks/main.yml
Normal file
1
parcels/roles/components/clickhouse/data/tasks/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
- include: install_clickhouse.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
<yandex>
|
||||
<!--ck集群节点-->
|
||||
<clickhouse_remote_servers>
|
||||
|
||||
<ck_cluster>
|
||||
<shard>
|
||||
<!-- Optional. Shard weight when writing data. Default: 1. -->
|
||||
<weight>1</weight>
|
||||
<!-- Optional. Whether to write data to just one of the replicas. Default: false (write data to all replicas). -->
|
||||
<internal_replication>false</internal_replication>
|
||||
<replica>
|
||||
<host>{{ inventory_hostname }}</host>
|
||||
<port>9001</port>
|
||||
<user>default</user>
|
||||
<password>{{ root_key }}</password>
|
||||
</replica>
|
||||
</shard>
|
||||
</ck_cluster>
|
||||
|
||||
</clickhouse_remote_servers>
|
||||
<zookeeper-servers>
|
||||
<session_timeout_ms>120000</session_timeout_ms>
|
||||
</zookeeper-servers>
|
||||
|
||||
<networks>
|
||||
<ip>::/0</ip>
|
||||
</networks>
|
||||
|
||||
<!--压缩相关配置-->
|
||||
<clickhouse_compression>
|
||||
<case>
|
||||
<min_part_size>10000000000</min_part_size>
|
||||
<min_part_size_ratio>0.01</min_part_size_ratio>
|
||||
<method>lz4</method> <!--压缩算法lz4压缩比zstd快, 更占磁盘-->
|
||||
</case>
|
||||
</clickhouse_compression>
|
||||
</yandex>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181"
|
||||
when: '(groups.zookeeper|length) == 3'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181,{{groups.zookeeper[3]}}:2181,{{groups.zookeeper[4]}}:2181"
|
||||
when: '(groups.zookeeper|length) >= 5'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
#拷贝clickhouse 配置文件
|
||||
- name: copy clickhouse config files
|
||||
template:
|
||||
src: 'ck_query.xml.j2'
|
||||
dest: '{{ data_path }}/clickhouse/clickhouse-server/metrika.xml'
|
||||
force: true
|
||||
backup: yes
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: copy set_query_node.sh to {{ data_path }}/clickhouse/clickhouse-server/
|
||||
template:
|
||||
src: 'set_query_node.sh.j2'
|
||||
dest: '{{ data_path }}/clickhouse/clickhouse-server/set_query_node.sh'
|
||||
force: true
|
||||
mode: 0755
|
||||
backup: yes
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: check unixODBC
|
||||
shell: rpm -qa | grep "unixODBC-2.3.1-11.el7.x86_64" | wc -l
|
||||
register: odbc_install
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: set zookeeper servers to clickhouse config
|
||||
shell: cd {{ data_path }}/clickhouse/clickhouse-server/ && ./set_zk_node.sh
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: set clickhouse query config
|
||||
shell: cd {{ data_path }}/clickhouse/clickhouse-server/ && ./set_query_node.sh
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: install clickhouse
|
||||
shell: "if [ `rpm -qa | grep {{ item.file }} | wc -l` -eq '0' ]; then rpm -ivh {{ data_path }}/clickhouse/rpm/{{ item.file }}.rpm ; fi"
|
||||
with_items:
|
||||
- { file: 'clickhouse-common-static-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-server-common-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-server-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-client-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ groups.clickhouse[0] }}"
|
||||
|
||||
- name: install clickhouse
|
||||
shell: "if [ `rpm -qa | grep {{ item.file }} | wc -l` -eq '0' ]; then rpm -ivh {{ data_path }}/clickhouse/rpm/{{ item.file }}.rpm ; fi"
|
||||
with_items:
|
||||
- { file: 'clickhouse-common-static-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-server-common-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-server-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
- { file: 'clickhouse-client-{{ clickhouse_version }}-1.el7.x86_64' }
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ groups.clickhouse[1] }}"
|
||||
|
||||
- name: set dir user
|
||||
shell: chown clickhouse:clickhouse -R {{ data_path }}/clickhouse/
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: copy clickhouse-server to /etc/init.d/
|
||||
shell: yes | cp -r {{ data_path }}/clickhouse/clickhouse-server/clickhouse-server /etc/init.d/clickhouse-server
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: deleted tmp file
|
||||
shell: rm -rf {{ data_path }}/clickhouse/clickhouse-server/ckquery_list {{ data_path }}/clickhouse/clickhouse-server/ckdata_list {{ data_path }}/clickhouse/clickhouse-server/set_zk_node.sh {{ data_path }}/clickhouse/clickhouse-server/set_query_node.sh
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
|
||||
- name: start clickhouse
|
||||
shell: service clickhouse-server start
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ groups.clickhouse[0] }}' }
|
||||
- { ip: '{{ groups.clickhouse[1] }}' }
|
||||
1
parcels/roles/components/clickhouse/query/tasks/main.yml
Normal file
1
parcels/roles/components/clickhouse/query/tasks/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
- include: install_clickhouse.yml
|
||||
@@ -0,0 +1,42 @@
|
||||
<yandex>
|
||||
<!--ck集群节点-->
|
||||
<clickhouse_remote_servers>
|
||||
|
||||
<!--clickhouse query集群节点-->
|
||||
<ck_query>
|
||||
|
||||
</ck_query>
|
||||
|
||||
|
||||
<!--clickhouse cluster集群节点-->
|
||||
<ck_cluster>
|
||||
|
||||
</ck_cluster>
|
||||
|
||||
|
||||
<!--clickhouse 所有节点-->
|
||||
<ck_all>
|
||||
|
||||
</ck_all>
|
||||
|
||||
</clickhouse_remote_servers>
|
||||
<zookeeper-servers>
|
||||
<session_timeout_ms>120000</session_timeout_ms>
|
||||
</zookeeper-servers>
|
||||
|
||||
<networks>
|
||||
<ip>::/0</ip>
|
||||
</networks>
|
||||
|
||||
<!--压缩相关配置-->
|
||||
<clickhouse_compression>
|
||||
<case>
|
||||
<min_part_size>10000000000</min_part_size>
|
||||
<min_part_size_ratio>0.01</min_part_size_ratio>
|
||||
<method>lz4</method> <!--压缩算法lz4压缩比zstd快, 更占磁盘-->
|
||||
</case>
|
||||
</clickhouse_compression>
|
||||
</yandex>
|
||||
|
||||
|
||||
|
||||
34
parcels/roles/components/clickhouse/query/templates/set_query_node.sh.j2
Executable file
34
parcels/roles/components/clickhouse/query/templates/set_query_node.sh.j2
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# <shard>
|
||||
# <!-- Optional. Shard weight when writing data. Default: 1. -->
|
||||
# <weight>1</weight>
|
||||
# <!-- Optional. Whether to write data to just one of the replicas. Default: false (write data to all replicas). -->
|
||||
# <internal_replication>false</internal_replication>
|
||||
# <replica>
|
||||
# <host>host</host>
|
||||
# <port>9001</port>
|
||||
# <user>default</user>
|
||||
# <password>password</password>
|
||||
# </replica>
|
||||
# </shard>
|
||||
|
||||
function set_conf(){
|
||||
line_num=`cat -n {{ data_path }}/clickhouse/clickhouse-server/metrika.xml |grep $1 |awk '{print $1}'|sed -n "1"p`
|
||||
line_num=`expr $line_num + 1`
|
||||
for node in `cat $2`
|
||||
do
|
||||
ipport=(${node//:/ })
|
||||
sed -i ''$line_num'a<shard>\n <!-- Optional. Shard weight when writing data. Default: 1. -->\n <weight>1</weight>\n <!-- Optional. Whether to write data to just one of the replicas. Default: false (write data to all replicas). -->\n <internal_replication>false</internal_replication>\n <replica>\n <host>'$node'</host>\n <port>9001</port>\n <user>default</user>\n <password>{{ root_key }}</password>\n </replica>\n</shard>\n' {{ data_path }}/clickhouse/clickhouse-server/metrika.xml
|
||||
start_num=`expr $line_num + 13`
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
set_conf ck_query ckquery_list
|
||||
|
||||
set_conf ck_cluster ckdata_list
|
||||
|
||||
set_conf ck_all ckdata_list
|
||||
|
||||
set_conf ck_all ckquery_list
|
||||
3
parcels/roles/components/druid/files/druid_ips
Normal file
3
parcels/roles/components/druid/files/druid_ips
Normal file
@@ -0,0 +1,3 @@
|
||||
192.168.44.33
|
||||
192.168.44.34
|
||||
192.168.44.35
|
||||
BIN
parcels/roles/components/druid/files/mysql
Executable file
BIN
parcels/roles/components/druid/files/mysql
Executable file
Binary file not shown.
278
parcels/roles/components/druid/tasks/install_druid.yml
Normal file
278
parcels/roles/components/druid/tasks/install_druid.yml
Normal file
@@ -0,0 +1,278 @@
|
||||
- name: node_nums to ansible variable
|
||||
set_fact: node_nums="{{groups.druid|length}}"
|
||||
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "Druid 集群最少需要配置3个节点,请修改configurations/hosts内对应IP列表。"
|
||||
when: node_nums < '3'
|
||||
|
||||
- name: check jdk 1.8_73
|
||||
shell: source /etc/profile && java -version 2>&1 | grep 1.8.0_73 | wc -l
|
||||
ignore_errors: false
|
||||
register: jdk_out
|
||||
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "检测到目标集群内存在JDK未安装节点,请检查"
|
||||
when: jdk_out.stdout != '2'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: copy mysql to /usr/bin/
|
||||
copy:
|
||||
src: '../files/mysql'
|
||||
dest: '/usr/bin/'
|
||||
force: true
|
||||
|
||||
- name: change mode
|
||||
shell: chmod +x /usr/bin/mysql
|
||||
|
||||
- block:
|
||||
- name: Check if the Druid service already exists
|
||||
shell: ps -ef |grep "org.apache.druid.cli.Main server" | grep -v grep | grep -v json | wc -l
|
||||
register: check_out
|
||||
- name: copy unload_druid.sh to {{ install_path }}/
|
||||
template:
|
||||
src: 'unload_druid.sh.j2'
|
||||
dest: '{{ install_path }}/unload_druid.sh'
|
||||
force: true
|
||||
mode: 0755
|
||||
when: check_out.stdout >= '1'
|
||||
- name: unload kafka
|
||||
shell: cd {{ install_path }} && sh unload_druid.sh
|
||||
when: check_out.stdout >= '1'
|
||||
- name: check if {{ mariadb_druid_database }} exist
|
||||
shell: mysql -s -uroot -p{{ galaxy_mariadb_pin }} -P3306 -h{{ gateway_keepalive_host }} -e "select count(1) from information_schema.schemata where schema_name='{{ mariadb_druid_database }}'" |grep 1|wc -l
|
||||
register: has_druid_out
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "127.0.0.1"
|
||||
- name: check database
|
||||
shell: mysql -s -uroot -p{{ galaxy_mariadb_pin }} -P3306 -h{{ gateway_keepalive_host }} -e "drop database {{ mariadb_druid_database }};"
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "127.0.0.1"
|
||||
when: has_druid_out.stdout == '1'
|
||||
- name: Ansible delete {{ install_path }}/unload_druid.sh
|
||||
file:
|
||||
path: "{{ install_path }}/unload_druid.sh"
|
||||
state: absent
|
||||
- name: Check if the Druid service already exists
|
||||
shell: ps -ef |grep "org.apache.druid.cli.Main server" | grep -v grep | grep -v json | wc -l
|
||||
register: check_out
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "卸载失败,组件可能非本安装部署,请手动卸载后继续安装"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: check_out.stdout >= '1'
|
||||
when: (allowed_unload) == "yes"
|
||||
|
||||
- block:
|
||||
- name: Check if the Druid service already exists
|
||||
shell: ps -ef |grep "org.apache.druid.cli.Main server" | grep -v grep | grep -v json | wc -l
|
||||
register: check_out
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "检测到目标集群内已有Druid请检查IP是否正确或停止/卸载已启动的组件"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: check_out.stdout >= '1'
|
||||
when: (allowed_unload) == "no"
|
||||
|
||||
- name: hadoop_ip to ansible variable
|
||||
set_fact: hadoop_ip="{{groups.hadoop[0]}}"
|
||||
|
||||
#- name: check if {{ mariadb_druid_database }} exist
|
||||
# shell: mysql -s -uroot -p{{ galaxy_mariadb_pin }} -P3306 -h{{ gateway_keepalive_host }} -e "select count(1) from information_schema.schemata where schema_name='{{ mariadb_druid_database }}'" |grep 1|wc -l
|
||||
# register: has_druid_out
|
||||
# run_once: true
|
||||
# delegate_facts: true
|
||||
# delegate_to: "127.0.0.1"
|
||||
|
||||
#- name: check database
|
||||
# fail:
|
||||
# msg: "mariadb已经存在Druid数据库,请确认删除后再次执行安装"
|
||||
# when: has_druid_out.stdout == '1'
|
||||
|
||||
- name: check hadoop datanode num ,If the service cannot ,Time out after 60 seconds
|
||||
shell: source /etc/profile && hadoop dfsadmin -report | grep "Live datanodes" | grep -E -o "[0-9]"
|
||||
async: 60
|
||||
register: datanode_out
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ hadoop_ip }}"
|
||||
|
||||
- name: check hadoop namenode num ,If the service cannot ,Time out after 60 seconds
|
||||
shell: source /etc/profile && hadoop dfsadmin -report |grep 50010 | wc -l
|
||||
async: 60
|
||||
register: namenode_out
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ hadoop_ip }}"
|
||||
|
||||
- fail:
|
||||
msg: "Hadoop 服务节点启动检测异常,请检查服务或是否已做免密登录"
|
||||
when: datanode_out.stdout <= '1' and namenode_out.stdout <= '1'
|
||||
|
||||
- name: create druid package path:{{ install_path }}
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}'
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181"
|
||||
when: '(groups.zookeeper|length) == 3'
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181,{{groups.zookeeper[3]}}:2181,{{groups.zookeeper[4]}}:2181"
|
||||
when: '(groups.zookeeper|length) >= 5'
|
||||
|
||||
- name: Create a new database with name {{ mariadb_druid_database }}
|
||||
shell: mysql -uroot -p{{ galaxy_mariadb_pin }} -P3306 -h{{ gateway_keepalive_host }} -e "create database {{ mariadb_druid_database }} default character set utf8mb4 collate utf8mb4_general_ci;"
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "127.0.0.1"
|
||||
|
||||
#复制tar到目标服务器
|
||||
- name: copy {{ druid_version }}.tar.gz
|
||||
copy:
|
||||
src: '{{ package_path }}/{{ druid_version }}.tar.gz'
|
||||
dest: '{{ install_path }}/'
|
||||
force: true
|
||||
backup: yes
|
||||
|
||||
#解压tar
|
||||
- name: unpack {{ druid_version }}.tar.gz
|
||||
unarchive:
|
||||
src: '{{ druid_version }}.tar.gz'
|
||||
dest: '{{ install_path }}/'
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: copy druid config files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'common.runtime.properties.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/_common/common.runtime.properties' }
|
||||
- { src: 'log4j2.xml.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/_common/log4j2.xml' }
|
||||
- { src: 'broker_runtime.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/query/broker/runtime.properties' }
|
||||
- { src: 'historical_runtime.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/data/historical/runtime.properties' }
|
||||
- { src: 'historical_jvm.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/data/historical/jvm.config' }
|
||||
- { src: 'middleManager_runtime.properties.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/data/middleManager/runtime.properties' }
|
||||
- { src: 'coordinator_jvm.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/master/coordinator-overlord/jvm.config' }
|
||||
- { src: 'broker_jvm.j2', dest: '{{ install_path }}/{{ druid_version }}/conf/druid/cluster/query/broker/jvm.config' }
|
||||
|
||||
#拷贝hadoop配置文件到 druid/conf
|
||||
- name: copy hadoop-conf to {{ install_path }}/{{ druid_version }}/conf/druid/cluster/_common/
|
||||
shell: "scp root@{{ hadoop_ip }}:{{ data_path }}/hadoop-2.7.1/etc/hadoop/{{ item.filename }} {{ install_path }}/{{ druid_version }}/conf/druid/cluster/_common/"
|
||||
with_items:
|
||||
- { filename: 'hdfs-site.xml' }
|
||||
- { filename: 'core-site.xml' }
|
||||
- { filename: 'yarn-site.xml' }
|
||||
- { filename: 'mapred-site.xml.bak' }
|
||||
|
||||
- name: master_ip to ansible variable
|
||||
set_fact: master_ip="{{groups.druid[0]}}"
|
||||
|
||||
- name: slave1_ip to ansible variable
|
||||
set_fact: slave1_ip="{{groups.druid[1]}}"
|
||||
|
||||
#拷贝druid 守护脚本/开机自启
|
||||
- name: copy Druid all start guardian/keep shell
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'dae-druid-all.sh.j2', dest: '{{ install_path }}/{{ druid_version }}/bin/dae-druid-all.sh' }
|
||||
- { src: 'keepdruidall.j2', dest: '/etc/init.d/keepdruidall' }
|
||||
when: node_nums <= cluster_limit
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: copy Druid query node guardian/keep shell for {{ master_ip }}
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
with_items:
|
||||
- { src: 'dae-druid-query.sh.j2', dest: '{{ install_path }}/{{ druid_version }}/bin/dae-druid-query.sh' }
|
||||
- { src: 'keepdruidquery.j2', dest: '/etc/init.d/keepdruidquery' }
|
||||
when: node_nums > cluster_limit
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: copy Druid query node guardian/keep shell for {{ slave1_ip }}
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave1_ip }}"
|
||||
with_items:
|
||||
- { src: 'dae-druid-query.sh.j2', dest: '{{ install_path }}/{{ druid_version }}/bin/dae-druid-query.sh' }
|
||||
- { src: 'keepdruidquery.j2', dest: '/etc/init.d/keepdruidquery' }
|
||||
when: node_nums > cluster_limit
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: copy Druid data node guardian shell
|
||||
template:
|
||||
src: 'dae-druid-data.sh.j2'
|
||||
dest: '{{ install_path }}/{{ druid_version }}/bin/dae-druid-data.sh'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
when: node_nums > cluster_limit and inventory_hostname != '{{master_ip}}' and inventory_hostname != '{{slave1_ip}}'
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: copy Druid data node keep shell
|
||||
template:
|
||||
src: 'keepdruiddata.j2'
|
||||
dest: '/etc/init.d/keepdruiddata'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
when: node_nums > cluster_limit and inventory_hostname != '{{master_ip}}' and inventory_hostname != '{{slave1_ip}}'
|
||||
|
||||
#拷贝set_druid_env.sh
|
||||
- name: copy set_druid_env.sh
|
||||
template:
|
||||
src: 'set_druid_env.sh.j2'
|
||||
dest: '{{ install_path }}/{{ druid_version }}/bin/set_druid_env.sh'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
|
||||
#配置druid环境变量
|
||||
- name: set druid env
|
||||
shell: sh {{ install_path }}/{{ druid_version }}/bin/set_druid_env.sh
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: start druid query node
|
||||
shell: source /etc/profile && sh /etc/init.d/keepdruidquery 'start'
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ master_ip }}' }
|
||||
- { ip: '{{ slave1_ip }}' }
|
||||
when: node_nums > cluster_limit
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: start druid data node
|
||||
shell: source /etc/profile && sh /etc/init.d/keepdruiddata 'start'
|
||||
when: node_nums > cluster_limit and inventory_hostname != '{{master_ip}}' and inventory_hostname != '{{slave1_ip}}'
|
||||
|
||||
#拷贝druid 配置文件
|
||||
- name: start druid all node
|
||||
shell: source /etc/profile && sh /etc/init.d/keepdruidall 'start'
|
||||
when: node_nums <= cluster_limit
|
||||
|
||||
- name: Ansible delete {{ druid_version }}.tar.gz
|
||||
file:
|
||||
path: "{{ install_path }}/{{ druid_version }}.tar.gz"
|
||||
state: absent
|
||||
1
parcels/roles/components/druid/tasks/main.yml
Normal file
1
parcels/roles/components/druid/tasks/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
- include: install_druid.yml
|
||||
10
parcels/roles/components/druid/templates/broker_jvm.j2
Normal file
10
parcels/roles/components/druid/templates/broker_jvm.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
-server
|
||||
-Xms{{ broker_mem }}m
|
||||
-Xmx{{ broker_mem }}m
|
||||
-XX:MaxDirectMemorySize={{ broker_MaxDirectMemorySize }}m
|
||||
-Duser.timezone=UTC
|
||||
-Dfile.encoding=UTF-8
|
||||
-Djava.io.tmpdir=var/tmp
|
||||
-Dlogfile.name=broker
|
||||
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
|
||||
|
||||
42
parcels/roles/components/druid/templates/broker_runtime.j2
Normal file
42
parcels/roles/components/druid/templates/broker_runtime.j2
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
druid.service=druid/broker
|
||||
druid.plaintextPort=8082
|
||||
druid.sql.planner.sqlTimeZone={{ local_time }}
|
||||
|
||||
# HTTP server settings
|
||||
druid.server.http.numThreads=60
|
||||
|
||||
# HTTP client settings
|
||||
druid.broker.http.numConnections=50
|
||||
druid.broker.http.maxQueuedBytes=10000000
|
||||
|
||||
# Processing threads and buffers
|
||||
druid.processing.buffer.sizeBytes={{ broker_sizeBytes }}
|
||||
druid.processing.numMergeBuffers={{ broker_numMergeBuffers }}
|
||||
druid.processing.numThreads={{ broker_numThreads }}
|
||||
druid.processing.tmpDir=var/druid/processing
|
||||
|
||||
# Query cache disabled -- push down caching and merging instead
|
||||
druid.broker.cache.useCache=false
|
||||
druid.broker.cache.populateCache=false
|
||||
|
||||
druid.query.groupBy.maxMergingDictionarySize=10000000000
|
||||
druid.query.groupBy.maxOnDiskStorage=10000000000
|
||||
@@ -0,0 +1,151 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
# Extensions specified in the load list will be loaded by Druid
|
||||
# We are using local fs for deep storage - not recommended for production - use S3, HDFS, or NFS instead
|
||||
# We are using local derby for the metadata store - not recommended for production - use MySQL or Postgres instead
|
||||
|
||||
# If you specify `druid.extensions.loadList=[]`, Druid won't load any extension from file system.
|
||||
# If you don't specify `druid.extensions.loadList`, Druid will load all the extensions under root extension directory.
|
||||
# More info: https://druid.apache.org/docs/latest/operations/including-extensions.html
|
||||
druid.extensions.loadList=["druid-hdfs-storage", "druid-kafka-indexing-service", "druid-datasketches", "mysql-metadata-storage", "druid-group-uniq-extension"]
|
||||
|
||||
# If you have a different version of Hadoop, place your Hadoop client jar files in your hadoop-dependencies directory
|
||||
# and uncomment the line below to point to your directory.
|
||||
#druid.extensions.hadoopDependenciesDir=/my/dir/hadoop-dependencies
|
||||
|
||||
|
||||
#
|
||||
# Hostname
|
||||
#
|
||||
druid.host={{ inventory_hostname }}
|
||||
|
||||
#
|
||||
# Logging
|
||||
#
|
||||
|
||||
# Log all runtime properties on startup. Disable to avoid logging properties on startup:
|
||||
druid.startup.logging.logProperties=true
|
||||
|
||||
#
|
||||
# Zookeeper
|
||||
#
|
||||
|
||||
druid.zk.service.host={{ zookeeper_servers }}
|
||||
druid.zk.paths.base=/druid
|
||||
|
||||
#
|
||||
# Metadata storage
|
||||
#
|
||||
|
||||
# For Derby server on your Druid Coordinator (only viable in a cluster with a single Coordinator, no fail-over):
|
||||
#druid.metadata.storage.type=derby
|
||||
#druid.metadata.storage.connector.connectURI=jdbc:derby://localhost:1527/var/druid/metadata.db;create=true
|
||||
#druid.metadata.storage.connector.host=localhost
|
||||
#druid.metadata.storage.connector.port=1527
|
||||
|
||||
# For MySQL (make sure to include the MySQL JDBC driver on the classpath):
|
||||
druid.metadata.storage.type=mysql
|
||||
druid.metadata.storage.connector.connectURI=jdbc:mysql://{{ gateway_keepalive_host }}:3306/{{ mariadb_druid_database }}
|
||||
druid.metadata.storage.connector.user=root
|
||||
druid.metadata.storage.connector.password={{ galaxy_mariadb_pin }}
|
||||
|
||||
# For PostgreSQL:
|
||||
#druid.metadata.storage.type=postgresql
|
||||
#druid.metadata.storage.connector.connectURI=jdbc:postgresql://db.example.com:5432/druid
|
||||
#druid.metadata.storage.connector.user=...
|
||||
#druid.metadata.storage.connector.password=...
|
||||
|
||||
#
|
||||
# Deep storage
|
||||
#
|
||||
|
||||
# For local disk (only viable in a cluster if this is a network mount):
|
||||
#druid.storage.type=local
|
||||
#druid.storage.storageDirectory=var/druid/segments
|
||||
|
||||
# For HDFS:
|
||||
druid.storage.type=hdfs
|
||||
druid.storage.storageDirectory=/druid/segments
|
||||
|
||||
# For S3:
|
||||
#druid.storage.type=s3
|
||||
#druid.storage.bucket=your-bucket
|
||||
#druid.storage.baseKey=druid/segments
|
||||
#druid.s3.accessKey=...
|
||||
#druid.s3.secretKey=...
|
||||
|
||||
#
|
||||
# Indexing service logs
|
||||
#
|
||||
|
||||
# For local disk (only viable in a cluster if this is a network mount):
|
||||
#druid.indexer.logs.type=file
|
||||
#druid.indexer.logs.directory=var/druid/indexing-logs
|
||||
|
||||
# For HDFS:
|
||||
druid.indexer.logs.type=hdfs
|
||||
druid.indexer.logs.directory=/druid/indexing-logs
|
||||
|
||||
druid.indexer.logs.kill.enabled=true
|
||||
druid.indexer.logs.kill.durationToRetain=604800000
|
||||
druid.indexer.logs.kill.delay=21600000
|
||||
|
||||
# For S3:
|
||||
#druid.indexer.logs.type=s3
|
||||
#druid.indexer.logs.s3Bucket=your-bucket
|
||||
#druid.indexer.logs.s3Prefix=druid/indexing-logs
|
||||
|
||||
|
||||
#
|
||||
# Service discovery
|
||||
#
|
||||
|
||||
druid.selectors.indexing.serviceName=druid/overlord
|
||||
druid.selectors.coordinator.serviceName=druid/coordinator
|
||||
|
||||
#
|
||||
# Monitoring
|
||||
#
|
||||
|
||||
druid.monitoring.monitors=["org.apache.druid.java.util.metrics.SysMonitor","org.apache.druid.java.util.metrics.JvmMonitor"]
|
||||
druid.emitter=http
|
||||
druid.emitter.logging.logLevel=info
|
||||
druid.emitter.http.recipientBaseUrl=http://{{ inventory_hostname }}:9903
|
||||
|
||||
# Storage type of double columns
|
||||
# ommiting this will lead to index double as float at the storage layer
|
||||
|
||||
druid.indexing.doubleStorage=double
|
||||
|
||||
#
|
||||
# Security
|
||||
#
|
||||
druid.server.hiddenProperties=["druid.s3.accessKey","druid.s3.secretKey","druid.metadata.storage.connector.password"]
|
||||
|
||||
|
||||
#
|
||||
# SQL
|
||||
#
|
||||
druid.sql.enable=true
|
||||
|
||||
#
|
||||
# Lookups
|
||||
#
|
||||
druid.lookup.enableLookupSyncOnStartup=false
|
||||
11
parcels/roles/components/druid/templates/coordinator_jvm.j2
Normal file
11
parcels/roles/components/druid/templates/coordinator_jvm.j2
Normal file
@@ -0,0 +1,11 @@
|
||||
-server
|
||||
-Xms{{ coordinator_mem }}m
|
||||
-Xmx{{ coordinator_mem }}m
|
||||
-XX:+UseG1GC
|
||||
-Duser.timezone=UTC
|
||||
-Dfile.encoding=UTF-8
|
||||
-Djava.io.tmpdir=var/tmp
|
||||
-Dlogfile.name=coordinator
|
||||
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
|
||||
-Dderby.stream.error.file=var/druid/derby.log
|
||||
|
||||
31
parcels/roles/components/druid/templates/dae-druid-all.sh.j2
Normal file
31
parcels/roles/components/druid/templates/dae-druid-all.sh.j2
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
source /etc/profile
|
||||
|
||||
BASH_DIR={{ install_path }}
|
||||
VERSION={{ druid_version }}
|
||||
|
||||
while true ; do
|
||||
|
||||
metrics=`ps -ef | grep druid-metrics | grep -v grep | wc -l`
|
||||
druid=`ps -ef | grep druid | grep -v grep | grep -v json | grep cluster.conf| wc -l`
|
||||
|
||||
if [ $druid -eq "0" ];then
|
||||
setsid nohup $BASH_DIR/$VERSION/bin/start-cluster-all-server > /dev/null 2>&1 &
|
||||
OLD_NUM=`cat $BASH_DIR/$VERSION/protect/restartsum/all-server`
|
||||
RESTART_NUM=`expr $OLD_NUM + 1`
|
||||
echo $RESTART_NUM > $BASh_DIR/$VERSION/protect/restartsum/all-server
|
||||
echo "`date +%Y-%m-%d` `date +%H:%M:%S` - restart start-cluster-all-server - 重启次数 -> $RESTART_NUM." >> $BASH_DIR/$VERSION/protect/protecthdfs.log
|
||||
fi
|
||||
|
||||
if [ $metrics -eq "0" ];then
|
||||
nohup java -jar -Xmx1024m -Xms1024m $BASH_DIR/$VERSION/monitor/druid-metrics.jar 9903 > $BASH_DIR/$VERSION/monitor/metrics.log 2>&1 &
|
||||
OLD_NUM=`cat $BASH_DIR/$VERSION/protect/restartsum/metrics`
|
||||
RESTART_NUM=`expr $OLD_NUM + 1`
|
||||
echo $RESTART_NUM > $BASH_DIR/$VERSION/protect/restartsum/metrics
|
||||
echo "`date +%Y-%m-%d` `date +%H:%M:%S` - restart druid-metrics.jar - 重启次数 -> $RESTART_NUM." >> $BASH_DIR/$VERSION/protect/protecthdfs.log
|
||||
fi
|
||||
|
||||
|
||||
sleep 60
|
||||
done
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
source /etc/profile
|
||||
|
||||
BASH_DIR={{ install_path }}
|
||||
VERSION={{ druid_version }}
|
||||
|
||||
while true ; do
|
||||
|
||||
metrics=`ps -ef | grep druid-metrics | grep -v grep | wc -l`
|
||||
druid=`ps -ef | grep druid | grep -v grep | grep -v json | grep data.conf | wc -l`
|
||||
|
||||
if [ $druid -eq "0" ];then
|
||||
setsid nohup $BASH_DIR/$VERSION/bin/start-cluster-data-server > /dev/null 2>&1 &
|
||||
OLD_NUM=`cat $BASH_DIR/$VERSION/protect/restartsum/data-server`
|
||||
RESTART_NUM=`expr $OLD_NUM + 1`
|
||||
echo $RESTART_NUM > $BASh_DIR/$VERSION/protect/restartsum/data-server
|
||||
echo "`date +%Y-%m-%d` `date +%H:%M:%S` - restart start-cluster-data-server - 重启次数 -> $RESTART_NUM." >> $BASH_DIR/$VERSION/protect/protecthdfs.log
|
||||
fi
|
||||
|
||||
if [ $metrics -eq "0" ];then
|
||||
nohup java -jar -Xmx1024m -Xms1024m $BASH_DIR/$VERSION/monitor/druid-metrics.jar 9903 > $BASH_DIR/$VERSION/monitor/metrics.log 2>&1 &
|
||||
OLD_NUM=`cat $BASH_DIR/$VERSION/protect/restartsum/metrics`
|
||||
RESTART_NUM=`expr $OLD_NUM + 1`
|
||||
echo $RESTART_NUM > $BASH_DIR/$VERSION/protect/restartsum/metrics
|
||||
echo "`date +%Y-%m-%d` `date +%H:%M:%S` - restart druid-metrics.jar - 重启次数 -> $RESTART_NUM." >> $BASH_DIR/$VERSION/protect/protecthdfs.log
|
||||
fi
|
||||
|
||||
|
||||
sleep 60
|
||||
done
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
source /etc/profile
|
||||
|
||||
BASH_DIR={{ install_path }}
|
||||
VERSION={{ druid_version }}
|
||||
|
||||
while true ; do
|
||||
|
||||
metrics=`ps -ef | grep druid-metrics | grep -v grep | wc -l`
|
||||
druid=`ps -ef | grep druid | grep -v grep | grep -v json | grep master-with-query.conf | wc -l`
|
||||
|
||||
if [ $druid -eq "0" ];then
|
||||
setsid nohup $BASH_DIR/$VERSION/bin/start-cluster-query-server > /dev/null 2>&1 &
|
||||
OLD_NUM=`cat $BASH_DIR/$VERSION/protect/restartsum/query-server`
|
||||
RESTART_NUM=`expr $OLD_NUM + 1`
|
||||
echo $RESTART_NUM > $BASh_DIR/$VERSION/protect/restartsum/query-server
|
||||
echo "`date +%Y-%m-%d` `date +%H:%M:%S` - restart start-cluster-query-server - 重启次数 -> $RESTART_NUM." >> $BASH_DIR/$VERSION/protect/protecthdfs.log
|
||||
fi
|
||||
|
||||
if [ $metrics -eq "0" ];then
|
||||
nohup java -jar -Xmx1024m -Xms1024m $BASH_DIR/$VERSION/monitor/druid-metrics.jar 9903 > $BASH_DIR/$VERSION/monitor/metrics.log 2>&1 &
|
||||
OLD_NUM=`cat $BASH_DIR/$VERSION/protect/restartsum/metrics`
|
||||
RESTART_NUM=`expr $OLD_NUM + 1`
|
||||
echo $RESTART_NUM > $BASH_DIR/$VERSION/protect/restartsum/metrics
|
||||
echo "`date +%Y-%m-%d` `date +%H:%M:%S` - restart druid-metrics.jar - 重启次数 -> $RESTART_NUM." >> $BASH_DIR/$VERSION/protect/protecthdfs.log
|
||||
fi
|
||||
|
||||
|
||||
sleep 60
|
||||
done
|
||||
|
||||
10
parcels/roles/components/druid/templates/historical_jvm.j2
Normal file
10
parcels/roles/components/druid/templates/historical_jvm.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
-server
|
||||
-Xms{{ historical_mem }}m
|
||||
-Xmx{{ historical_mem }}m
|
||||
-XX:MaxDirectMemorySize={{ historical_MaxDirectMemorySize }}m
|
||||
-Duser.timezone=UTC
|
||||
-Dfile.encoding=UTF-8
|
||||
-Djava.io.tmpdir=var/tmp
|
||||
-Dlogfile.name=historical
|
||||
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
druid.service=druid/historical
|
||||
druid.plaintextPort=8083
|
||||
|
||||
# HTTP server threads
|
||||
druid.server.http.numThreads=60
|
||||
|
||||
# Processing threads and buffers
|
||||
druid.processing.buffer.sizeBytes={{ historical_buffer_sizeBytes }}
|
||||
druid.processing.numMergeBuffers={{ historical_numMergeBuffers }}
|
||||
druid.processing.numThreads={{ historical_numThreads }}
|
||||
druid.processing.tmpDir=var/druid/processing
|
||||
|
||||
# Segment storage
|
||||
#druid.segmentCache.locations=[{"path":"var/druid/segment-cache","maxSize":3000000000000}]
|
||||
#druid.server.maxSize=35000000000000
|
||||
druid.segmentCache.locations=[{"path":"var/druid/segment-cache","maxSize":{{ segmentCache_max_size }}}]
|
||||
druid.server.maxSize={{ server_disk_maxsize }}
|
||||
|
||||
# Query cache
|
||||
druid.historical.cache.useCache=true
|
||||
druid.historical.cache.populateCache=true
|
||||
druid.cache.type=caffeine
|
||||
druid.cache.sizeInBytes=256000000
|
||||
|
||||
druid.query.groupBy.maxMergingDictionarySize=10000000000
|
||||
druid.query.groupBy.maxOnDiskStorage=10000000000
|
||||
42
parcels/roles/components/druid/templates/keepdruidall.j2
Normal file
42
parcels/roles/components/druid/templates/keepdruidall.j2
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# netconsole This loads the netconsole module with the configured parameters.
|
||||
#
|
||||
# chkconfig:123456 40 60
|
||||
# description: keepdruidall
|
||||
source /etc/profile
|
||||
PRO_NAME=keepdruidall
|
||||
|
||||
INS_DIR={{ install_path }}
|
||||
#版本
|
||||
VERSION={{ druid_version }}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
master=`ps -ef | grep dae-druid-all.sh | grep -v grep | wc -l`
|
||||
if [ $master -lt 1 ];then
|
||||
nohup $INS_DIR/$VERSION/bin/dae-druid-all.sh > /dev/null 2>&1 &
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
keeppid=`ps -ef | grep dae-druid-all.sh | grep -v grep | awk '{print $2}'`
|
||||
echo "守护进程PID:$keeppid"
|
||||
kill -9 $keeppid
|
||||
echo "关闭所有druid进程"
|
||||
#ps aux | grep druid | grep -v grep | awk '{print $2}' | xargs kill -9
|
||||
livenum=`ps -ef |grep "druid" | grep -v grep | grep -v json | wc -l`
|
||||
if [ $livenum -ne 0 ];then
|
||||
ps aux|grep "druid" |grep -v grep | awk '{print $2}'| xargs kill -9
|
||||
fi
|
||||
;;
|
||||
|
||||
status)
|
||||
ps -ef | grep druid | grep -v grep | grep -v json
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "use keepdruidall [start|stop|status]"
|
||||
;;
|
||||
esac
|
||||
|
||||
42
parcels/roles/components/druid/templates/keepdruiddata.j2
Normal file
42
parcels/roles/components/druid/templates/keepdruiddata.j2
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# netconsole This loads the netconsole module with the configured parameters.
|
||||
#
|
||||
# chkconfig:123456 40 60
|
||||
# description: keepdruiddata
|
||||
source /etc/profile
|
||||
PRO_NAME=keepdruiddata
|
||||
|
||||
INS_DIR={{ install_path }}
|
||||
#版本
|
||||
VERSION={{ druid_version }}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
master=`ps -ef | grep dae-druid-data.sh | grep -v grep | wc -l`
|
||||
if [ $master -lt 1 ];then
|
||||
nohup $INS_DIR/$VERSION/bin/dae-druid-data.sh > /dev/null 2>&1 &
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
keeppid=`ps -ef | grep dae-druid-data.sh | grep -v grep | awk '{print $2}'`
|
||||
echo "守护进程PID:$keeppid"
|
||||
kill -9 $keeppid
|
||||
echo "关闭所有druid进程"
|
||||
#ps aux | grep druid | grep -v grep | awk '{print $2}' | xargs kill -9
|
||||
livenum=`ps -ef |grep "druid" | grep -v grep | grep -v json | wc -l`
|
||||
if [ $livenum -ne 0 ];then
|
||||
ps aux|grep "druid" |grep -v grep | awk '{print $2}'| xargs kill -9
|
||||
fi
|
||||
;;
|
||||
|
||||
status)
|
||||
ps -ef | grep druid | grep -v grep | grep -v json
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "use keepdruiddata [start|stop|status]"
|
||||
;;
|
||||
esac
|
||||
|
||||
42
parcels/roles/components/druid/templates/keepdruidquery.j2
Normal file
42
parcels/roles/components/druid/templates/keepdruidquery.j2
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# netconsole This loads the netconsole module with the configured parameters.
|
||||
#
|
||||
# chkconfig:123456 40 60
|
||||
# description: keepdruidquery
|
||||
source /etc/profile
|
||||
PRO_NAME=keepdruidquery
|
||||
|
||||
INS_DIR={{ install_path }}
|
||||
#版本
|
||||
VERSION={{ druid_version }}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
master=`ps -ef | grep dae-druid-query.sh | grep -v grep | wc -l`
|
||||
if [ $master -lt 1 ];then
|
||||
nohup $INS_DIR/$VERSION/bin/dae-druid-query.sh > /dev/null 2>&1 &
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
keeppid=`ps -ef | grep dae-druid-query.sh | grep -v grep | awk '{print $2}'`
|
||||
echo "守护进程PID:$keeppid"
|
||||
kill -9 $keeppid
|
||||
echo "关闭所有druid进程"
|
||||
#ps aux | grep druid | grep -v grep | awk '{print $2}' | xargs kill -9
|
||||
livenum=`ps -ef |grep "druid" | grep -v grep | grep -v json | wc -l`
|
||||
if [ $livenum -ne 0 ];then
|
||||
ps aux|grep "druid" |grep -v grep | awk '{print $2}'| xargs kill -9
|
||||
fi
|
||||
;;
|
||||
|
||||
status)
|
||||
ps -ef | grep druid | grep -v grep | grep -v json
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "use keepdruidquery [start|stop|status]"
|
||||
;;
|
||||
esac
|
||||
|
||||
76
parcels/roles/components/druid/templates/log4j2.xml.j2
Normal file
76
parcels/roles/components/druid/templates/log4j2.xml.j2
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
<Configuration status="WARN">
|
||||
<properties>
|
||||
<property name="pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} %c{1.} %t [%p] %msg%n</property>
|
||||
<property name="patternNoTime">%msg%n</property>
|
||||
<property name="patternMetrics">%d %-8r %m%n</property>
|
||||
<property name="logPath">{{ install_path }}/{{ druid_version }}/var/sv</property>
|
||||
</properties>
|
||||
<appenders>
|
||||
<RollingFile name="STDOUT"
|
||||
fileName="${logPath}/${sys:logfile.name}.log"
|
||||
filePattern="${logPath}/history/${sys:logfile.name}-%d{yyyy-MM-dd}.log.%i.gz">
|
||||
|
||||
<PatternLayout>
|
||||
<pattern>${pattern}</pattern>
|
||||
</PatternLayout>
|
||||
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/> <!-- Or every 100 MB -->
|
||||
</Policies>
|
||||
|
||||
<DefaultRolloverStrategy max="10">
|
||||
<Delete basePath="${LOG_PATH}/history" maxDepth="1">
|
||||
<IfFileName glob="*.gz">
|
||||
<IfLastModified age="7d">
|
||||
<!--<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="200 GB" />
|
||||
</IfAny>-->
|
||||
</IfLastModified>
|
||||
</IfFileName>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
|
||||
</RollingFile>
|
||||
|
||||
<!--
|
||||
<RollingFile name="METRICS"
|
||||
fileName="${logPath}/${sys:logfile.name}.metrics"
|
||||
filePattern="${logPath}/old/${sys:logfile.name}-%d{yyyy-MM-dd}.metrics.%i.gz">
|
||||
<PatternLayout>
|
||||
<pattern>${patternMetrics}</pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="6"/>
|
||||
</RollingFile>
|
||||
-->
|
||||
|
||||
</appenders>
|
||||
|
||||
<loggers>
|
||||
<Root level="error">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</Root>
|
||||
|
||||
</loggers>
|
||||
</Configuration>
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
druid.service=druid/middleManager
|
||||
druid.plaintextPort=8091
|
||||
|
||||
# Number of tasks per middleManager
|
||||
druid.worker.capacity=200
|
||||
|
||||
# Task launch parameters
|
||||
druid.indexer.runner.javaOpts=-server {{ middlemanager_runner_javaOpts }} -Duser.timezone=UTC -Dfile.encoding=UTF-8 -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Dlog4j.configurationFile=conf/druid/cluster/_common/log4j2-task.xml
|
||||
druid.indexer.task.baseTaskDir=var/druid/task
|
||||
|
||||
# HTTP server threads
|
||||
druid.server.http.numThreads=60
|
||||
|
||||
# Processing threads and buffers on Peons
|
||||
druid.indexer.fork.property.druid.processing.numMergeBuffers={{ middlemanager_numMergeBuffers }}
|
||||
druid.indexer.fork.property.druid.processing.buffer.sizeBytes={{ middlemanager_buffer_sizeBytes }}
|
||||
druid.indexer.fork.property.druid.processing.numThreads={{ middlemanager_numThreads }}
|
||||
|
||||
# Hadoop indexing
|
||||
druid.indexer.task.hadoopWorkingPath=var/druid/hadoop-tmp
|
||||
|
||||
druid.query.groupBy.maxMergingDictionarySize=10000000000
|
||||
druid.query.groupBy.maxOnDiskStorage=10000000000
|
||||
|
||||
30
parcels/roles/components/druid/templates/set_druid_env.sh.j2
Normal file
30
parcels/roles/components/druid/templates/set_druid_env.sh.j2
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
#num=`cat /etc/profile | grep druid | wc -l`
|
||||
|
||||
#if [ $num -eq "0" ];then
|
||||
# echo -e "\n#druid" >> /etc/profile
|
||||
# echo -e "export DRUID_HOME={{ install_path }}/{{ druid_version }}" >> /etc/profile
|
||||
# echo -e "export PATH=\$DRUID_HOME/bin:\$PATH" >> /etc/profile
|
||||
# source /etc/profile
|
||||
#fi
|
||||
|
||||
keeppath='/etc/init.d/keepdruidall'
|
||||
if [ -x $keeppath ];then
|
||||
chkconfig --add keepdruidall
|
||||
chkconfig keepdruidall on
|
||||
fi
|
||||
|
||||
keeppath='/etc/init.d/keepdruiddata'
|
||||
if [ -x $keeppath ];then
|
||||
chkconfig --add keepdruiddata
|
||||
chkconfig keepdruiddata on
|
||||
fi
|
||||
|
||||
keeppath='/etc/init.d/keepdruidquery'
|
||||
if [ -x $keeppath ];then
|
||||
chkconfig --add keepdruidquery
|
||||
chkconfig keepdruidquery on
|
||||
fi
|
||||
|
||||
43
parcels/roles/components/druid/templates/unload_druid.sh.j2
Normal file
43
parcels/roles/components/druid/templates/unload_druid.sh.j2
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
source /etc/profile
|
||||
|
||||
function killService(){
|
||||
keeppath='/etc/init.d/keepdruidall'
|
||||
if [ -x $keeppath ];then
|
||||
service keepdruidall stop
|
||||
chkconfig keepdruidall off
|
||||
systemctl daemon-reload
|
||||
rm -rf /etc/init.d/keepdruidall
|
||||
fi
|
||||
|
||||
keeppath='/etc/init.d/keepdruiddata'
|
||||
if [ -x $keeppath ];then
|
||||
service keepdruiddata stop
|
||||
chkconfig keepdruiddata off
|
||||
systemctl daemon-reload
|
||||
rm -rf /etc/init.d/keepdruiddata
|
||||
fi
|
||||
|
||||
keeppath='/etc/init.d/keepdruidquery'
|
||||
if [ -x $keeppath ];then
|
||||
service keepdruidquery stop
|
||||
chkconfig keepdruidquery off
|
||||
systemctl daemon-reload
|
||||
rm -rf /etc/init.d/keepdruidquery
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function killPid(){
|
||||
|
||||
livenum=`ps -ef |grep "druid" | grep -v grep | grep -v json | wc -l`
|
||||
if [ $livenum -ne 0 ];then
|
||||
ps aux|grep "druid" |grep -v grep | awk '{print $2}'| xargs kill -9
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
killService
|
||||
sleep 15
|
||||
killPid
|
||||
rm -rf {{ install_path }}/{{ druid_version }}
|
||||
0
parcels/roles/components/druid/vars/main.yml
Normal file
0
parcels/roles/components/druid/vars/main.yml
Normal file
9
parcels/roles/components/hadoop/files/get_qjournal.sh
Executable file
9
parcels/roles/components/hadoop/files/get_qjournal.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
hdfsip=`pwd`/roles/commons/hadoop/files/iplist
|
||||
|
||||
|
||||
jourzk=`sed -n '1,1p' $hdfsip`\:8485\;`sed -n '2,2p' $hdfsip`\:8485\;`sed -n '3,3p' $hdfsip`\:8485
|
||||
|
||||
|
||||
echo $jourzk
|
||||
3
parcels/roles/components/hadoop/files/iplist
Normal file
3
parcels/roles/components/hadoop/files/iplist
Normal file
@@ -0,0 +1,3 @@
|
||||
192.168.44.33
|
||||
192.168.44.34
|
||||
192.168.44.35
|
||||
310
parcels/roles/components/hadoop/tasks/install_hadoop.yml
Normal file
310
parcels/roles/components/hadoop/tasks/install_hadoop.yml
Normal file
@@ -0,0 +1,310 @@
|
||||
- name: node_nums to ansible variable
|
||||
set_fact: node_nums="{{groups.hadoop|length}}"
|
||||
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "Hadoop 集群最少需要配置3个节点,请修改configurations/hosts内对应IP列表。"
|
||||
when: node_nums < '3'
|
||||
|
||||
- name: check jdk 1.8_73
|
||||
shell: source /etc/profile && java -version 2>&1 | grep 1.8.0_73 | wc -l
|
||||
ignore_errors: false
|
||||
register: jdk_out
|
||||
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "检测到目标集群内存在JDK未安装节点,请检查"
|
||||
when: jdk_out.stdout != '2'
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: create hadoop package path:{{ install_path }}
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ install_path }}'
|
||||
|
||||
- block:
|
||||
- name: Check if the Hadoop service already exists
|
||||
shell: source /etc/profile && jps -l | egrep "org.apache.hadoop.hdfs.qjournal.server.JournalNode|org.apache.hadoop.hdfs.tools.DFSZKFailoverController|org.apache.hadoop.hdfs.server.datanode.DataNode|org.apache.hadoop.hdfs.server.namenode.NameNode" | wc -l
|
||||
register: check_out
|
||||
- name: copy unload_hadoop.sh to {{ install_path }}/
|
||||
template:
|
||||
src: 'unload_hadoop.sh.j2'
|
||||
dest: '{{ install_path }}/unload_hadoop.sh'
|
||||
force: true
|
||||
mode: 0755
|
||||
when: check_out.stdout >= '1'
|
||||
- name: unload kafka
|
||||
shell: cd {{ install_path }} && sh unload_hadoop.sh
|
||||
when: check_out.stdout >= '1'
|
||||
- name: Ansible delete {{ install_path }}/unload_hadoop.sh
|
||||
file:
|
||||
path: "{{ install_path }}/unload_hadoop.sh"
|
||||
state: absent
|
||||
- name: Check if the Hadoop service already exists
|
||||
shell: source /etc/profile && jps -l | egrep "org.apache.hadoop.hdfs.qjournal.server.JournalNode|org.apache.hadoop.hdfs.tools.DFSZKFailoverController|org.apache.hadoop.hdfs.server.datanode.DataNode|org.apache.hadoop.hdfs.server.namenode.NameNode" | wc -l
|
||||
register: check_out
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "卸载失败,组件可能非本安装部署,请手动卸载后继续安装"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: check_out.stdout >= '1'
|
||||
when: (allowed_unload) == "yes"
|
||||
|
||||
- block:
|
||||
- name: Check if the Hadoop service already exists
|
||||
shell: source /etc/profile && jps -l | egrep "org.apache.hadoop.hdfs.qjournal.server.JournalNode|org.apache.hadoop.hdfs.tools.DFSZKFailoverController|org.apache.hadoop.hdfs.server.datanode.DataNode|org.apache.hadoop.hdfs.server.namenode.NameNode" | wc -l
|
||||
register: check_out
|
||||
- name: To terminate execution
|
||||
fail:
|
||||
msg: "检测到目标集群内已有Hadoop请检查IP是否正确或停止/卸载已启动的组件"
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
when: check_out.stdout >= '1'
|
||||
when: (allowed_unload) == "no"
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181"
|
||||
when: '(groups.zookeeper|length) == 3'
|
||||
|
||||
- name: get zookeeper_servers to ansible variable
|
||||
set_fact: zookeeper_servers="{{groups.zookeeper[0]}}:2181,{{groups.zookeeper[1]}}:2181,{{groups.zookeeper[2]}}:2181,{{groups.zookeeper[3]}}:2181,{{groups.zookeeper[4]}}:2181"
|
||||
when: '(groups.zookeeper|length) >= 5'
|
||||
|
||||
- name: create hadoop package path:{{ data_path }}/hadoop
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ data_path }}/hadoop'
|
||||
|
||||
#复制tar到目标服务器
|
||||
- name: copy hadoop-2.7.1.tar.gz
|
||||
copy:
|
||||
src: '{{ package_path }}/hadoop-2.7.1.tar.gz'
|
||||
dest: '{{ install_path }}/'
|
||||
force: true
|
||||
backup: yes
|
||||
|
||||
#解压tar
|
||||
- name: unpack hadoop-2.7.1.tar.gz
|
||||
unarchive:
|
||||
src: 'hadoop-2.7.1.tar.gz'
|
||||
dest: '{{ install_path }}/'
|
||||
|
||||
#获取slaves列表
|
||||
- name: get slaves to:{{ install_path }}/{{ hadoop_version }}/etc/hadoop/slaves
|
||||
shell: echo "{{ ansible_play_hosts_all }}" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" > {{ install_path }}/{{ hadoop_version }}/etc/hadoop/slaves
|
||||
|
||||
- name: get master_ip
|
||||
shell: sed -n '1,1p' {{ install_path }}/{{ hadoop_version }}/etc/hadoop/slaves
|
||||
register: master_out
|
||||
|
||||
- name: master_ip to ansible variable
|
||||
set_fact: master_ip="{{master_out.stdout}}"
|
||||
|
||||
- name: get slave1_ip
|
||||
shell: sed -n '2,2p' {{ install_path }}/{{ hadoop_version }}/etc/hadoop/slaves
|
||||
register: slave1_out
|
||||
|
||||
- name: slave1_ip to ansible variable
|
||||
set_fact: slave1_ip="{{slave1_out.stdout}}"
|
||||
|
||||
- name: get slave2_ip
|
||||
shell: sed -n '3,3p' {{ install_path }}/{{ hadoop_version }}/etc/hadoop/slaves
|
||||
register: slave2_out
|
||||
|
||||
- name: slave2_ip to ansible variable
|
||||
set_fact: slave2_ip="{{slave2_out.stdout}}"
|
||||
|
||||
- name: qjournal servers to ansible variable
|
||||
set_fact: qjournal_servers="{{groups.hadoop[0]}}:8485;{{groups.hadoop[1]}}:8485;{{groups.hadoop[2]}}:8485"
|
||||
|
||||
#拷贝hdfs 配置文件
|
||||
- name: copy hadoop config files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'core-site.xml.j2', dest: '{{ install_path }}/{{ hadoop_version }}/etc/hadoop/core-site.xml' }
|
||||
- { src: 'hadoop-env.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/etc/hadoop/hadoop-env.sh' }
|
||||
- { src: 'hdfs-site.xml.j2', dest: '{{ install_path }}/{{ hadoop_version }}/etc/hadoop/hdfs-site.xml' }
|
||||
- { src: 'mapred-site.xml.bak.j2', dest: '{{ install_path }}/{{ hadoop_version }}/etc/hadoop/mapred-site.xml.bak' }
|
||||
- { src: 'yarn-site.xml.j2', dest: '{{ install_path }}/{{ hadoop_version }}/etc/hadoop/yarn-site.xml' }
|
||||
|
||||
#拷贝hdfs matser守护及开机自启脚本
|
||||
- name: copy hadoop master files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'dae-hdfsjournal.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/sbin/dae-hdfsjournal.sh' }
|
||||
- { src: 'dae-hdfsmaster.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/sbin/dae-hdfsmaster.sh' }
|
||||
- { src: 'keephdfsmaster.j2', dest: '/etc/init.d/keephdfsmaster' }
|
||||
- { src: 'keephdfsjournal.j2', dest: '/etc/init.d/keephdfsjournal' }
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
#拷贝hdfs slave1_ip守护及开机自启脚本
|
||||
- name: copy hadoop slave1_ip files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'dae-hdfsjournal.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/sbin/dae-hdfsjournal.sh' }
|
||||
- { src: 'dae-hdfsslave.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/sbin/dae-hdfsslave.sh' }
|
||||
- { src: 'keephdfsslave.j2', dest: '/etc/init.d/keephdfsslave' }
|
||||
- { src: 'keephdfsjournal.j2', dest: '/etc/init.d/keephdfsjournal' }
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave1_ip }}"
|
||||
|
||||
#拷贝hdfs slave2_ip守护及开机自启脚本
|
||||
- name: copy hadoop slave2_ip files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'dae-hdfsjournal.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/sbin/dae-hdfsjournal.sh' }
|
||||
- { src: 'keephdfsjournal.j2', dest: '/etc/init.d/keephdfsjournal' }
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave2_ip }}"
|
||||
|
||||
#拷贝hdfs 其他工作节点守护及开机自启脚本
|
||||
- name: copy hadoop worker files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
with_items:
|
||||
- { src: 'dae-hdfsworker.sh.j2', dest: '{{ install_path }}/{{ hadoop_version }}/sbin/dae-hdfsworker.sh' }
|
||||
- { src: 'keephdfsworker.j2', dest: '/etc/init.d/keephdfsworker' }
|
||||
|
||||
#拷贝 设置环境变量脚本
|
||||
- name: copy set_hadoop_env.sh path:{{ install_path }}/{{ hadoop_version }}/bin/
|
||||
template:
|
||||
src: 'set_hadoop_env.sh.j2'
|
||||
dest: '{{ install_path }}/{{ hadoop_version }}/bin/set_hadoop_env.sh'
|
||||
mode: 0755
|
||||
backup: yes
|
||||
|
||||
#配置环境变量
|
||||
- name: set hadoop env
|
||||
shell: cd {{ install_path }}/{{ hadoop_version }}/bin/ && ./set_hadoop_env.sh
|
||||
|
||||
- name: start hadoop journal
|
||||
shell: source /etc/profile && sh /etc/init.d/keephdfsjournal start
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ item.ip }}"
|
||||
with_items:
|
||||
- { ip: '{{ master_ip }}' }
|
||||
- { ip: '{{ slave1_ip }}' }
|
||||
- { ip: '{{ slave2_ip }}' }
|
||||
|
||||
- name: start {{ master_ip }} journal
|
||||
shell: source /etc/profile && jps | grep JournalNode | grep -v grep | wc -l
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
register: status_out1
|
||||
|
||||
- name: start {{ slave1_ip }} journal
|
||||
shell: source /etc/profile && jps | grep JournalNode | grep -v grep | wc -l
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave1_ip }}"
|
||||
register: status_out2
|
||||
|
||||
- name: start {{ slave2_ip }} journal
|
||||
shell: source /etc/profile && jps | grep JournalNode | grep -v grep | wc -l
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave2_ip }}"
|
||||
register: status_out3
|
||||
|
||||
- name: copy hadoop initialize files
|
||||
template:
|
||||
src: 'ini_hadoop.sh.j2'
|
||||
dest: '{{ install_path }}/{{ hadoop_version }}/bin/ini_hadoop.sh'
|
||||
backup: yes
|
||||
mode: 0755
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
- name: Waiting for the JournalNode start,sleep 30s
|
||||
shell: sleep 30
|
||||
|
||||
- fail:
|
||||
msg: "JournalNode节点启动异常,请检查JournalNode"
|
||||
when: status_out1.stdout != '1' and status_out2.stdout != '1' and status_out3.stdout != '1'
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
- name:
|
||||
shell: sh {{ install_path }}/{{ hadoop_version }}/bin/ini_hadoop.sh 1 | grep "yes" | grep -v grep | wc -l
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
register: ini_out
|
||||
when: status_out1.stdout == '1' and status_out2.stdout == '1' and status_out3.stdout == '1'
|
||||
|
||||
- fail:
|
||||
msg: "namenode 初始化异常"
|
||||
when: ini_out.stdout != '1'
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
- name:
|
||||
shell: sh {{ install_path }}/{{ hadoop_version }}/bin/ini_hadoop.sh 2 | grep "yes" | grep -v grep | wc -l
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
register: ini_out2
|
||||
when: ini_out.stdout == '1'
|
||||
|
||||
- fail:
|
||||
msg: "hadoop-zk 初始化异常"
|
||||
when: ini_out2.stdout != '1'
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
- name: start hadoop-master
|
||||
shell: service keephdfsmaster start
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
- name: Waiting for the Master-namenode start,sleep 30s
|
||||
shell: sleep 30
|
||||
|
||||
- name: copy namenode files to Standby
|
||||
shell: "yes | {{ install_path }}/{{ hadoop_version }}/bin/hdfs namenode -bootstrapStandby"
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave1_ip }}"
|
||||
|
||||
- name: start hadoop-slave
|
||||
shell: service keephdfsslave start
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ slave1_ip }}"
|
||||
|
||||
- name: start hadoop-worker
|
||||
shell: service keephdfsworker start
|
||||
|
||||
- name: deleted hadoop.tar.gz
|
||||
shell: rm -rf {{ install_path }}/hadoop-2.7.1.tar.gz
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user