中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

storm中基于k8s的安裝示例

發布時間:2021-11-12 11:29:47 來源:億速云 閱讀:235 作者:小新 欄目:云計算

這篇文章主要介紹了storm中基于k8s的安裝示例,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

首先我們先來編寫一下Dockerfile

FROM ip:80/bigdata/centos7-jdk:1.8
#config storm env
ENV STORM_USER=storm \
    STORM_INSTALL_BASE=/home/frank/platform \
    STORM_HOME=/home/frank/platform/storm \
    STORM_CONF_DIR=/home/frank/conf/storm \
    STORM_DIR=/home/frank/hard_disk/storm \
    STORM_BLOBS=/home/frank/hard_disk/storm/blobs \
    STORM_NIMBUS=/home/frank/hard_disk/storm/nimbus \
    STORM_LOG_DIR=/home/frank/logs/storm \ 
    STORM_ROOT=/home/frank \
    STORM_LOG=/home/frank/logs
ENV PATH $PATH:$STORM_HOME/bin
#add FLINK user and make dirs
RUN set -x \
    && adduser "$STORM_USER" \
    && mkdir -p "$STORM_INSTALL_BASE" "$STORM_CONF_DIR" "$STORM_LOG" "$STORM_LOG_DIR" "$STORM_BLOBS" "$STORM_NIMBUS"
#install storm libs
ADD apache-storm-1.2.2.tar.gz  $STORM_INSTALL_BASE
RUN cd $STORM_INSTALL_BASE && ln -s -f apache-storm-1.2.2 storm && mkdir -p /home/storm

RUN chown -R "$STORM_USER:$STORM_USER" "$STORM_ROOT"
COPY docker-entrypoint.sh /home/storm
RUN chmod 755 /home/storm/docker-entrypoint.sh
USER storm
ENTRYPOINT ["/home/storm/docker-entrypoint.sh"]

其中的腳本如下:

#!/bin/sh
# If unspecified, the hostname of the container is taken as the JobManager address
ACTION_CMD="$1"
source /etc/profile 
export STORM_CONF_DIR=/home/frank/conf/storm
export STORM_CONF_FILE=/home/frank/conf/storm/storm.yaml
sed -i -e "s/storm.zookeeper.servers: \[localhost\]/storm.zookeeper.servers: \[${STORM_ZK_QUORUM}\]/" /home/frank/conf/storm/storm.yaml
sed -i -e "s/storm.zookeeper.root: \"\/storm\"/storm.zookeeper.root: \/${STORM_ZK_ROOT}/" /home/frank/conf/storm/storm.yaml
# if use cluster model, pod ${JOB_CLUSTER_NAME}-0,${JOB_CLUSTER_NAME}-1 as jobmanager
if [ ${ACTION_CMD} == "cluster" ]; then
  nimbuses=(${NIMBUS_HOSTS//,/ })
  ACTION_CMD="supervisor"
  for i in ${!nimbuses[@]}
  do
      if [ "$(hostname -s)" == "${nimbuses[i]}" ]; then
          NIMBUS_ADDRESS=${NIMBUS_ADDRESS:-$(hostname -f)}
          ACTION_CMD="nimbus"
          sed -i -e "s/nimbus.seeds: \[localhost\]/nimbus.seeds: \["${NIMBUS_ADDRESS}"\]/" /home/frank/conf/storm/storm.yaml
          echo "pod hostname match nimbus config host, change action to nimbus."
      fi
  done
fi
# if ha model, replace ha configuration
if [ ${ACTION_CMD} == "help" ]; then
    echo "Usage: $(basename "$0") (cluster|nimbus|supervisor|ui|logviewer|help)"
    exit 0
elif [ ${ACTION_CMD} == "nimbus" ]; then
    echo "Starting nimbus ui logviewer supervisor"
    nohup /home/frank/platform/storm/bin/storm nimbus >> /tmp/nimbus.log  2>&1 & \
    nohup /home/frank/platform/storm/bin/storm ui >> /tmp/ui.log 2>&1 & \
    /home/frank/platform/storm/bin/storm logviewer
elif [ ${ACTION_CMD} == "supervisor" ]; then
    echo "Starting supervisor"
    /home/frank/platform/storm/bin/storm supervisor 
fi

鏡像構建命令如下:

docker build --network=host -f Dockerfile -t ip:80/bigdata/storm:1.2.2 .

下面我們提供一下service的創建文件

apiVersion: v1
kind: Service
metadata:
  name: storm-cluster
  labels:
    app: storm-cluster
  namespace: storm
spec:
  clusterIP: None
  ports:
    - port: 8080
      name: ui
  selector:
    app: storm-cluster

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: storm-cluster
  namespace: storm
spec:
  selector:
    matchLabels:
      app: storm-cluster
  serviceName: storm-cluster
  replicas: 4
  podManagementPolicy: Parallel
  template:
    metadata:
      labels:
        app: storm-cluster
    spec:
      terminationGracePeriodSeconds: 2
      containers:
      - name: storm-cluster
        imagePullPolicy: Always
        image: ip:80/bigdata/storm:1.2.2
        command: ["/bin/sleep"]
        args: ["30d"]
        volumeMounts:
          - name: storm-conf
            mountPath: /home/conf/storm
          - name: storm-log
            mountPath: /home/logs/storm
        resources:
          requests:
            memory: "4096Mi"
            cpu: 4
          limits:
            memory: "4096Mi"
            cpu: 4
        env:
        - name: NIMBUS_HOSTS
          value: "storm-cluster-2,storm-cluster-3"
        - name: STORM_ZK_QUORUM
          value: "ip"
        - name: STORM_ZK_ROOT
          value: "stormNew"
        ports:
        - containerPort: 6627
          name: nimbus
        - containerPort: 8000
          name: logviewer
        - containerPort: 8080
          name: storm-ui
        - containerPort: 6700
          name: sv0
        - containerPort: 6701
          name: sv1
        - containerPort: 6702
          name: sv2
        - containerPort: 6703
          name: sv3
        - containerPort: 22
          name: ssh
      volumes:
        - name: storm-conf
          configMap:
            name: storm-conf
        - name: storm-log
          hostPath:
            path: /stormtmp
            type: Directory
service的創建腳本如下:

kubectl create -f storm-svc.yaml

statefulSet的創建腳本如下:

kubectl create -f storm-statefulSet.yaml

這個創建腳本要注意如下問題:

command:/bin/sleep

程序需要手動啟動

/home/vipshop/hard_disk/storm

drwxr-xr-x 2 storm storm 4096 Jul 12 12:20 blobs
drwxr-xr-x 2 storm storm 4096 Jul 12 12:20 nimbus
drwxrwxr-x 5 storm storm 4096 Jul 29 00:00 supervisor
這個hard_disk目錄需要有storm權限

注:nimbus.thrift.max_buffer_size: 10485760

這個參數需要是2的倍數

感謝你能夠認真閱讀完這篇文章,希望小編分享的“storm中基于k8s的安裝示例”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

万宁市| 福建省| 定边县| 沅江市| 岳普湖县| 浦城县| 喀喇| 新化县| 时尚| 乾安县| 靖边县| 广饶县| 沁阳市| 贞丰县| 冀州市| 昆明市| 和顺县| 慈利县| 商洛市| 伊金霍洛旗| 绍兴县| 中方县| 赤水市| 南投市| 正镶白旗| 弋阳县| 南汇区| 南平市| 安吉县| 武鸣县| 开阳县| 游戏| 太白县| 宁强县| 汤原县| 尚志市| 唐海县| 冷水江市| 武义县| 乌兰县| 都匀市|