[#140] Add Hbase TTL environment variables to configure
This commit is contained in:
parent
d40dd89496
commit
61065c6812
16
.env
16
.env
|
@ -11,7 +11,21 @@ PINPOINT_ZOOKEEPER_ADDRESS=zoo1
|
|||
### Pinpoint-Hbase
|
||||
|
||||
PINPOINT_HBASE_NAME=pinpoint-hbase
|
||||
#config for hbase in external docker
|
||||
AGENTINFO_TTL=31536000
|
||||
AGENTSTATV2_TTL=5184000
|
||||
APPSTATAGGRE_TTL=5184000
|
||||
APPINDEX_TTL=31536000
|
||||
AGENTLIFECYCLE_TTL=5184000
|
||||
AGENTEVENT_TTL=5184000
|
||||
STRINGMETADATA_TTL=15552000
|
||||
APIMETADATA_TTL=31536000
|
||||
SQLMETADATA_TTL=15552000
|
||||
TRACEV2_TTL=5184000
|
||||
APPTRACEINDEX_TTL=5184000
|
||||
APPMAPSTATCALLERV2_TTL=5184000
|
||||
APPMAPSTATCALLEV2_TTL=5184000
|
||||
APPMAPSTATSELFV2_TTL=5184000
|
||||
HOSTAPPMAPV2_TTL=5184000
|
||||
|
||||
### Pinpoint-mysql
|
||||
MYSQL_ROOT_PASSWORD=root123
|
||||
|
|
|
@ -12,7 +12,22 @@ services:
|
|||
image: "pinpointdocker/pinpoint-hbase:${PINPOINT_VERSION}"
|
||||
networks:
|
||||
- pinpoint
|
||||
|
||||
environment:
|
||||
- AGENTINFO_TTL=${AGENTINFO_TTL}
|
||||
- AGENTSTATV2_TTL=${AGENTSTATV2_TTL}
|
||||
- APPSTATAGGRE_TTL=${APPSTATAGGRE_TTL}
|
||||
- APPINDEX_TTL=${APPINDEX_TTL}
|
||||
- AGENTLIFECYCLE_TTL=${AGENTLIFECYCLE_TTL}
|
||||
- AGENTEVENT_TTL=${AGENTEVENT_TTL}
|
||||
- STRINGMETADATA_TTL=${STRINGMETADATA_TTL}
|
||||
- APIMETADATA_TTL=${APIMETADATA_TTL}
|
||||
- SQLMETADATA_TTL=${SQLMETADATA_TTL}
|
||||
- TRACEV2_TTL=${TRACEV2_TTL}
|
||||
- APPTRACEINDEX_TTL=${APPTRACEINDEX_TTL}
|
||||
- APPMAPSTATCALLERV2_TTL=${APPMAPSTATCALLERV2_TTL}
|
||||
- APPMAPSTATCALLEV2_TTL=${APPMAPSTATCALLEV2_TTL}
|
||||
- APPMAPSTATSELFV2_TTL=${APPMAPSTATSELFV2_TTL}
|
||||
- HOSTAPPMAPV2_TTL=${HOSTAPPMAPV2_TTL}
|
||||
volumes:
|
||||
- hbase_data:/home/pinpoint/hbase
|
||||
- /home/pinpoint/zookeeper
|
||||
|
|
|
@ -13,10 +13,12 @@ COPY hbase-site.xml hbase-site.xml
|
|||
COPY hbase-env.sh hbase-env.sh
|
||||
COPY /build/scripts/initialize-hbase.sh /usr/local/bin/
|
||||
COPY /build/scripts/check-table.sh /usr/local/bin/
|
||||
COPY /build/scripts/configure-hbase.sh /usr/local/bin
|
||||
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y curl && apt-get clean \
|
||||
&& chmod a+x /usr/local/bin/initialize-hbase.sh \
|
||||
&& chmod a+x /usr/local/bin/check-table.sh \
|
||||
&& chmod a+x /usr/local/bin/configure-hbase.sh \
|
||||
&& mkdir -p ${BASE_DIR} \
|
||||
&& cd ${BASE_DIR} \
|
||||
&& curl -fSL "${HBASE_REPOSITORY}/${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz" -o hbase.tar.gz || curl -fSL "${HBASE_SUB_REPOSITORY}/${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz" -o hbase.tar.gz \
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
if echo -e "exists 'HostApplicationMap_Ver2'" | ${HBASE_HOME}/bin/hbase shell 2>&1 | grep -q "does exist" 2>/dev/null
|
||||
then
|
||||
echo "Tables already exist"
|
||||
sleep 15
|
||||
${HBASE_HOME}/bin/hbase shell ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
else
|
||||
sleep 15
|
||||
echo "create tables"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
cp ${BASE_DIR}/hbase-create.hbase ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
|
||||
sed -i "/AgentInfo/s/TTL => .[[:digit:]]*/TTL => ${AGENTINFO_TTL:-31536000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/AgentStatV2/s/TTL => .[[:digit:]]*/TTL => ${AGENTSTATV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApplicationStatAggre/s/TTL => .[[:digit:]]*/TTL => ${APPSTATAGGRE_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApplicationIndex/s/TTL => .[[:digit:]]*/TTL => ${APPINDEX_TTL:-31536000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/AgentLifeCycle/s/TTL => .[[:digit:]]*/TTL => ${AGENTLIFECYCLE_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/AgentEvent/s/TTL => .[[:digit:]]*/TTL => ${AGENTEVENT_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/StringMetaData/s/TTL => .[[:digit:]]*/TTL => ${STRINGMETADATA_TTL:-15552000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApiMetaData/s/TTL => .[[:digit:]]*/TTL => ${APIMETADATA_TTL:-31536000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/SqlMetaData_Ver2/s/TTL => .[[:digit:]]*/TTL => ${SQLMETADATA_TTL:-15552000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/TraceV2/s/TTL => .[[:digit:]]*/TTL => ${TRACEV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApplicationTraceIndex/s/TTL => .[[:digit:]]*/TTL => ${APPTRACEINDEX_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApplicationMapStatisticsCaller_Ver2/s/TTL => .[[:digit:]]*/TTL => ${APPMAPSTATCALLERV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApplicationMapStatisticsCallee_Ver2/s/TTL => .[[:digit:]]*/TTL => ${APPMAPSTATCALLEV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/ApplicationMapStatisticsSelf_Ver2/s/TTL => .[[:digit:]]*/TTL => ${APPMAPSTATSELFV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
sed -i "/HostApplicationMap_Ver2/s/TTL => .[[:digit:]]*/TTL => ${HOSTAPPMAPV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-create.hbase
|
||||
|
||||
sed -i "s/create/alter/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/AgentInfo/s/TTL => .[[:digit:]]*/TTL => ${AGENTINFO_TTL:-31536000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/AgentStatV2/s/TTL => .[[:digit:]]*/TTL => ${AGENTSTATV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApplicationStatAggre/s/TTL => .[[:digit:]]*/TTL => ${APPSTATAGGRE_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApplicationIndex/s/TTL => .[[:digit:]]*/TTL => ${APPINDEX_TTL:-31536000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/AgentLifeCycle/s/TTL => .[[:digit:]]*/TTL => ${AGENTLIFECYCLE_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/AgentEvent/s/TTL => .[[:digit:]]*/TTL => ${AGENTEVENT_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/StringMetaData/s/TTL => .[[:digit:]]*/TTL => ${STRINGMETADATA_TTL:-15552000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApiMetaData/s/TTL => .[[:digit:]]*/TTL => ${APIMETADATA_TTL:-31536000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/SqlMetaData_Ver2/s/TTL => .[[:digit:]]*/TTL => ${SQLMETADATA_TTL:-15552000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/TraceV2/s/TTL => .[[:digit:]]*/TTL => ${TRACEV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApplicationTraceIndex/s/TTL => .[[:digit:]]*/TTL => ${APPTRACEINDEX_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApplicationMapStatisticsCaller_Ver2/s/TTL => .[[:digit:]]*/TTL => ${APPMAPSTATCALLERV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApplicationMapStatisticsCallee_Ver2/s/TTL => .[[:digit:]]*/TTL => ${APPMAPSTATCALLEV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/ApplicationMapStatisticsSelf_Ver2/s/TTL => .[[:digit:]]*/TTL => ${APPMAPSTATSELFV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
sed -i "/HostApplicationMap_Ver2/s/TTL => .[[:digit:]]*/TTL => ${HOSTAPPMAPV2_TTL:-5184000}/g" ${BASE_DIR}/hbase-update-ttl.hbase
|
||||
|
||||
exec "$@"
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
${HBASE_HOME}/bin/start-hbase.sh
|
||||
|
||||
/usr/local/bin/configure-hbase.sh
|
||||
/usr/local/bin/check-table.sh
|
Loading…
Reference in New Issue