首页 > 其他分享 >es-spark +docker

es-spark +docker

时间:2024-06-13 14:43:19浏览次数:21  
标签:docker elastic HADOOP hadoop VERSION && SPARK spark es

本项目使用es+spark的技术,并且采用容器进行项目的构建

FROM ubuntu:20.04

RUN apt-get update -y && apt-get install vim -y && apt-get install wget -y && apt-get install ssh -y && apt-get install openjdk-8-jdk -y && apt-get install sudo -y && apt-get install curl -y && apt-get install jq -y
RUN useradd -m elastic && echo "elastic:supergroup" | chpasswd && adduser elastic sudo && echo "elastic     ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && cd /usr/bin/ && sudo ln -s python3 python

COPY ssh_config /etc/ssh/ssh_config

WORKDIR /home/elastic

USER elastic
ARG HADOOP_VERSION=3.3.1
ARG SPARK_VERSION=3.4.3
ARG SPARK_HADOOP_VERSION=3
ARG ELASTICSEARCH_VERSION=8.6.0
ARG ES_SPARK_SPARK_VERSION=30
ARG ES_SPARK_SCALA_VERSION=2.12
ARG ES_SPARK_ES_VERSION=$ELASTICSEARCH_VERSION

ARG ES_SPARK_VERSION=${ES_SPARK_SPARK_VERSION}_$ES_SPARK_SCALA_VERSION-$ES_SPARK_ES_VERSION

RUN wget --no-check-certificate https://repo.huaweicloud.com/apache/hadoop/common/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz && tar zxvf hadoop-$HADOOP_VERSION.tar.gz && rm hadoop-$HADOOP_VERSION.tar.gz
RUN wget https://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-$SPARK_VERSION/spark-$SPARK_VERSION-bin-hadoop$SPARK_HADOOP_VERSION.tgz && tar zxvf spark-$SPARK_VERSION-bin-hadoop$SPARK_HADOOP_VERSION.tgz && rm spark-$SPARK_VERSION-bin-hadoop$SPARK_HADOOP_VERSION.tgz
RUN wget -q https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz && tar zxvf elasticsearch-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz && rm elasticsearch-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz
RUN wget -q https://artifacts.elastic.co/downloads/kibana/kibana-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz && tar zxvf kibana-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz && rm kibana-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz
RUN wget -q -O ./elasticsearch-spark-$ES_SPARK_VERSION.jar https://search.maven.org/remotecontent?filepath=org/elasticsearch/elasticsearch-spark-${ES_SPARK_SPARK_VERSION}_$ES_SPARK_SCALA_VERSION/$ES_SPARK_ES_VERSION/elasticsearch-spark-$ES_SPARK_VERSION.jar
RUN ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys

ENV HDFS_NAMENODE_USER elastic
ENV HDFS_DATANODE_USER elastic
ENV HDFS_SECONDARYNAMENODE_USER elastic

ENV YARN_RESOURCEMANAGER_USER elastic
ENV YARN_NODEMANAGER_USER elastic

ENV HADOOP_HOME /home/elastic/hadoop-$HADOOP_VERSION
ENV HADOOP_CONF_DIR=/home/elastic/hadoop-$HADOOP_VERSION/etc/hadoop/
ENV ES_HOME /home/elastic/elasticsearch-$ELASTICSEARCH_VERSION
ENV KIBANA_HOME /home/elastic/kibana-$ELASTICSEARCH_VERSION
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh
RUN echo "server.host: 0.0.0.0" >> $KIBANA_HOME/config/kibana.yml
RUN echo "xpack.security.enabled: false" >> $ES_HOME/config/elasticsearch.yml
RUN echo 'alias es-spark="/home/elastic/spark-'$SPARK_VERSION'-bin-hadoop'$SPARK_HADOOP_VERSION'/bin/spark-shell --master yarn --deploy-mode client --jars /home/elastic/elasticsearch-spark-'$ES_SPARK_VERSION'.jar"' >> ~/.bashrc
RUN echo 'alias es-pyspark="/home/elastic/spark-'$SPARK_VERSION'-bin-hadoop'$SPARK_HADOOP_VERSION'/bin/pyspark --master yarn --deploy-mode client --jars /home/elastic/elasticsearch-spark-'$ES_SPARK_VERSION'.jar"' >> ~/.bashrc
COPY core-site.xml $HADOOP_HOME/etc/hadoop/
COPY hdfs-site.xml $HADOOP_HOME/etc/hadoop/
COPY yarn-site.xml $HADOOP_HOME/etc/hadoop/
COPY docker-entrypoint.sh $HADOOP_HOME/etc/hadoop/

ENV PATH $PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

EXPOSE 50070 50075 50010 50020 50090 8020 9000 9864 9870 10020 19888 8088 8030 8031 8032 8033 8040 8042 22 9200 9300 5601

#ENTRYPOINT ["${HADOOP_HOME}/etc/hadoop/docker-entrypoint.sh"]
ENTRYPOINT "${HADOOP_HOME}/etc/hadoop/docker-entrypoint.sh"

标签:docker,elastic,HADOOP,hadoop,VERSION,&&,SPARK,spark,es
From: https://www.cnblogs.com/zhangcheng1234/p/18245830

相关文章

  • Dragon Boat Festival
    TheDragonBoatFestival,atime-honoredtraditioninChina,encapsulatestheessenceofculture,family,andperseverance.ThisdayisalwaysfilledwithmarvelousdelightforaslongasIcanremember.Lastyear'sDragonBoatFestivalseemedlikey......
  • DockerCompose+Jenkins+Pipeline流水线打包Vue项目(解压安装配置Node)入门
    场景DockerCompose+Jenkins+Pipeline流水线打包SpringBoot项目(解压安装配置JDK、Maven等)入门:https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/139631755以上使用流水线配置和打包springboot后台项目,如果要使用流水线和配置node打包vue项目,可按如下步骤。注:博......
  • Failed to connect to ESP8266: Timed out waiting for packet header
    解决办法:可能是板子类型选选择的问题board=esp01_1m改为board=nodemcuv2问题复现开发板:ESP-01s平台:PlatformIO+Clion刷写固件的时候报错FailedtoconnecttoESP8266:Timedoutwaitingforpacketheader下载器用的这种下载时报错连接不上开发板更改后......
  • [1008] PyPDF2, Merge PDF files, Insert PDF files
    Ref:ThePdfMergerClass:mergesmultiplePDFsintoasinglePDF.merge():Mergethepagesfromthegivenfileintotheoutputfileatthespecifiedpagenumber.append():Identicaltothemerge() method,butassumesyouwanttoconcatenateallpages......
  • C#中使用AutoResetEvent或者ManualResetEvent做线程管理
    1.Task/thread/sync/async..await/WhenAll相关基础知识参见此处链接2.什么是AutoResetEvent和ManualResetEvent事件他们都是C#中System.Threading下面的类。用于在多个线程之间进行事件通知和管理。他们的管理方法主要是三个:Reset():关闭WaitOne():阻挡Set():启动AutoR......
  • 从零开始写 Docker(十八)---容器网络实现(下):为容器插上”网线“
    本文为从零开始写Docker系列第十八篇,利用linux下的Veth、Bridge、iptables等等相关技术,构建容器网络模型,为容器插上”网线“。完整代码见:https://github.com/lixd/mydocker欢迎Star推荐阅读以下文章对docker基本实现有一个大致认识:核心原理:深入理解Docker核心......
  • The Enchantment of the Dragon Boat Festival
    TheEnchantmentoftheDragonBoatFestivalAstheearlyJuneiscoming,theringoftheDragonBoatFestivalhadunconsciouslyknocked.IwastransportedbacktotheenchantingatmosphereoftheDragonBoatFestival.Thisfestival,deeplyrootedinChin......
  • The Dragon Boat Festival
    TheDragonBoatFestivalapproaching,abuzzofanticipationfillstheair.Thisancientcelebration,passeddownfromgenerationtogeneration,notonlyrepresentsatimeforcommunity,butalsoajourneyofremembrance.Actually,Ididn'tpayattent......
  • Drangon Boat Festival
    DragonBoatFestival,alsoknownas DuanwuFestival,isatraditionalCbinesefestivalcelebratedonthefifthdayofthefifthmonthinthelunarcalendar.Thisyear,itfallsonJune14thintheGregoriancalendar.ThefestivaliswidelycelebratedinC......
  • PostgreSQL的视图pg_views
    PostgreSQL的视图pg_viewspg_views是PostgreSQL中的一个系统视图,用于显示数据库中所有视图(views)的相关信息。视图是一个虚拟表,其内容由查询定义。通过查询pg_views视图,数据库管理员和开发人员可以查看当前数据库中定义的所有视图的信息。pg_views视图的主要列列名......