美文网首页
imooc-大数据学习

imooc-大数据学习

作者: shenmou | 来源:发表于2020-03-28 12:19 被阅读0次

    脚本笔记:

    提前创建 docker-compose 需要用到的网络 es_network
    docker network create es_network
    
    run.sh
    #!/bin/bash
    
    docker-compose -f docker-compose.yml up -d namenode hive-metastore-postgresql
    docker-compose -f docker-compose.yml up -d datanode hive-metastore
    docker-compose -f docker-compose.yml up -d resourcemanager
    docker-compose -f docker-compose.yml up -d nodemanager
    docker-compose -f docker-compose.yml up -d historyserver
    sleep 5
    docker-compose -f docker-compose.yml up -d hive-server
    docker-compose -f docker-compose.yml up -d spark-master spark-worker
    docker-compose -f docker-compose.yml up -d mysql-server
    docker-compose -f docker-compose.yml up -d elasticsearch
    docker-compose -f docker-compose.yml up -d kibana
    my_ip=`ip route get 1|awk '{print $NF;exit}'`
    echo "Namenode: http://${my_ip}:50070"
    echo "Datanode: http://${my_ip}:50075"
    echo "Spark-master: http://${my_ip}:8080"
    docker-compose exec spark-master bash -c "./copy-jar.sh && exit"
    
    stop.sh
    #!/bin/bash
    docker-compose stop
    
    copy-jar.sh
    #!/bin/bash
    
    # 需要给此脚本加上可执行权限(chmod)
    
    cd /opt/hadoop-2.8.0/share/hadoop/yarn/lib/ && cp jersey-core-1.9.jar jersey-client-1.9.jar /spark/jars/ && rm -rf /spark/jars/jersey-client-2.22.2.jar
    
    hadoop-hive.env
    HIVE_SITE_CONF_javax_jdo_option_ConnectionURL=jdbc:postgresql://hive-metastore-postgresql/metastore
    HIVE_SITE_CONF_javax_jdo_option_ConnectionDriverName=org.postgresql.Driver
    HIVE_SITE_CONF_javax_jdo_option_ConnectionUserName=hive
    HIVE_SITE_CONF_javax_jdo_option_ConnectionPassword=hive
    HIVE_SITE_CONF_datanucleus_autoCreateSchema=false
    HIVE_SITE_CONF_hive_metastore_uris=thrift://hive-metastore:9083
    HIVE_SITE_CONF_hive_metastore_warehouse_dir=hdfs://namenode:8020/user/hive/warehouse
    
    CORE_CONF_fs_defaultFS=hdfs://namenode:8020
    CORE_CONF_hadoop_http_staticuser_user=root
    CORE_CONF_hadoop_proxyuser_hue_hosts=*
    CORE_CONF_hadoop_proxyuser_hue_groups=*
    
    HDFS_CONF_dfs_webhdfs_enabled=true
    HDFS_CONF_dfs_permissions_enabled=false
    
    YARN_CONF_yarn_log___aggregation___enable=true
    YARN_CONF_yarn_resourcemanager_recovery_enabled=true
    YARN_CONF_yarn_resourcemanager_store_class=org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore
    YARN_CONF_yarn_resourcemanager_fs_state___store_uri=/rmstate
    YARN_CONF_yarn_nodemanager_remote___app___log___dir=/app-logs
    YARN_CONF_yarn_log_server_url=http://historyserver:8188/applicationhistory/logs/
    YARN_CONF_yarn_timeline___service_enabled=true
    YARN_CONF_yarn_timeline___service_generic___application___history_enabled=true
    YARN_CONF_yarn_resourcemanager_system___metrics___publisher_enabled=true
    YARN_CONF_yarn_resourcemanager_hostname=resourcemanager
    YARN_CONF_yarn_timeline___service_hostname=historyserver
    YARN_CONF_yarn_resourcemanager_address=resourcemanager:8032
    YARN_CONF_yarn_resourcemanager_scheduler_address=resourcemanager:8030
    YARN_CONF_yarn_resourcemanager_resource__tracker_address=resourcemanager:8031
    
    docker-compose.yml
    version: '2'
    services:
      namenode:
        image: bde2020/hadoop-namenode:1.1.0-hadoop2.8-java8
        container_name: namenode
        volumes:
          - ./data/namenode:/hadoop/dfs/name
        environment:
          - CLUSTER_NAME=test
        env_file:
          - ./hadoop-hive.env
        ports:
          - 50070:50070
          - 8020:8020
    
      resourcemanager:
        image: bde2020/hadoop-resourcemanager:1.1.0-hadoop2.8-java8
        container_name: resourcemanager
        environment:
          - CLUSTER_NAME=test
        env_file:
          - ./hadoop-hive.env
        ports:
          - 8088:8088
    
      historyserver:
        image: bde2020/hadoop-historyserver:1.1.0-hadoop2.8-java8
        container_name: historyserver
        environment:
          - CLUSTER_NAME=test
        env_file:
          - ./hadoop-hive.env
        ports:
          - 8188:8188
    
      datanode:
        image: bde2020/hadoop-datanode:1.1.0-hadoop2.8-java8
        depends_on:
          - namenode
        volumes:
          - ./data/datanode:/hadoop/dfs/data
        env_file:
          - ./hadoop-hive.env
        ports:
          - 50075:50075
    
      nodemanager:
        image: bde2020/hadoop-nodemanager:1.1.0-hadoop2.8-java8
        container_name: nodemanager
        hostname: nodemanager
        environment:
          - CLUSTER_NAME=test
        env_file:
          - ./hadoop-hive.env
        ports:
          - 8042:8042
    
      hive-server:
        image: bde2020/hive:2.1.0-postgresql-metastore
        container_name: hive-server
        env_file:
          - ./hadoop-hive.env
        environment:
          - "HIVE_CORE_CONF_javax_jdo_option_ConnectionURL=jdbc:postgresql://hive-metastore/metastore"
        ports:
          - "10000:10000"
    
      hive-metastore:
        image: bde2020/hive:2.1.0-postgresql-metastore
        container_name: hive-metastore
        env_file:
          - ./hadoop-hive.env
        command: /opt/hive/bin/hive --service metastore
        ports:
          - 9083:9083
    
      hive-metastore-postgresql:
        image: bde2020/hive-metastore-postgresql:2.1.0
        ports:
          - 5432:5432
        volumes:
          - ./data/postgresql/:/var/lib/postgresql/data
    
      spark-master:
        image: bde2020/spark-master:2.1.0-hadoop2.8-hive-java8
        container_name: spark-master
        hostname: spark-master
        volumes:
          - ./copy-jar.sh:/copy-jar.sh
        ports:
          - 8080:8080
          - 7077:7077
        env_file:
          - ./hadoop-hive.env
    
    
      spark-worker:
        image: bde2020/spark-worker:2.1.0-hadoop2.8-hive-java8
        depends_on:
          - spark-master
        environment:
          - SPARK_MASTER=spark://spark-master:7077
        ports:
          - "8081:8081"
        env_file:
          - ./hadoop-hive.env
      mysql-server:
        image: mysql:5.7
        container_name: mysql-server
        ports:
          - "3306:3306"
        environment:
          - MYSQL_ROOT_PASSWORD=zhangyang517
        volumes:
          - ./data/mysql:/var/lib/mysql
    
      elasticsearch:
        image: elasticsearch:6.5.3
        environment:
          - discovery.type=single-node
        ports:
          - "9200:9200"
          - "9300:9300"
        networks:
          - es_network
      kibana:
        image: kibana:6.5.3
        ports:
          - "5601:5601"
        networks:
          - es_network
    
    networks:
      es_network:
        external: true
    

    相关文章

      网友评论

          本文标题:imooc-大数据学习

          本文链接:https://www.haomeiwen.com/subject/gpmjuhtx.html