: :其他软件 2020-09-09 16:41:39
制作Dockerfile,
Dockerfile文件内容:
FROM centos:8
#环境配置
RUN yum install -y openssh openssh-clients openssh-server which net-tools
RUN ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys
RUN yum install -y java-1.8.0-openjdk-devel
#安装Hadoop
COPY ./hadoop-3.2.1.tar.gz /tmp/tar/hadoop-3.2.1.tar.gz
RUN cd /tmp/tar/ && tar -zxf hadoop-3.2.1.tar.gz -C /opt && rm -f hadoop-3.2.1.tar.gz
COPY ./.bashrc /root/.bashrc
COPY ./core-site.xml /opt/hadoop-3.2.1/etc/hadoop/core-site.xml
COPY ./hdfs-site.xml /opt/hadoop-3.2.1/etc/hadoop/hdfs-site.xml
COPY ./mapred-site.xml /opt/hadoop-3.2.1/etc/hadoop/mapred-site.xml
COPY ./yarn-site.xml /opt/hadoop-3.2.1/etc/hadoop/yarn-site.xml
#安装HBase
COPY ./hbase-2.3.1-bin.tar.gz /tmp/tar/hbase-2.3.1-bin.tar.gz
RUN cd /tmp/tar/ && tar -zxf hbase-2.3.1-bin.tar.gz -C /opt && rm -f hbase-2.3.1-bin.tar.gz
#修改$HBASE_HOME/conf/hbase-env.sh文件,添加JAVA_HOME配置
COPY ./hbase-env.sh /opt/hbase-2.3.1/conf/hbase-env.sh
#安装PostgreSQL
RUN yum install -y @postgresql:12
WORKDIR /opt
.bashrc文件内容:
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk/jre
export JRE_HOME=${JAVA_HOME}
export CLASSPAT=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export HDFS_NAMENODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export HDFS_DATANODE_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
entrypoint.sh文件内容:
#!/bin/bash
systemctl start sshd
tail -f /dev/null
hbase-env.sh文件内容(配置hbase的JAVA_HOME):
#!/usr/bin/env bash
#修改了jre环境变量
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk/jre
以下几个xml文件是启动三种模式Hadoop集群所需要修改的配置:
Local (Standalone) Mode
Pseudo-Distributed Mode(core-site.xml、hdfs-site.xml)
Fully-Distributed Mode(mapred-site.xml、yarn-site.xml)
core-site.xml文件内容:
hdfs-site.xml文件内容:
mapred-site.xml文件内容:
yarn-site.xml文件内容:
创建镜像:docker build -t hadoop .
查看镜像:docker images
docker镜像导出,tar镜像包可以拷贝到其他机器docker环境中加载:docker save hadoop -o hadoop.tar
5、将tar镜像包(hadoop.tar)拷贝到需要安装的服务器/容器上,然后:docker load -i hadoop.tar
6、运行镜像:docker run -itd --privileged --name hadoop -p 9000:9000 hadoop /usr/sbin/init
7、创建完成后: 使用以下命令进入容器
docker exec -it hadoop bash
安装完成!
10-05c++ thrift 访问 hbase
08-31postgresql内核代码分析
01-04Learning PySpark
01-02PostgreSQL从入门到精通
12-17java调用spark简单demo
12-24bright spark 1.10汉化版