文档章节

ssh+hadoop+flink+zookpeer+kafka安装

xd03122049
 xd03122049
发布于 06/14 23:56
字数 2036
阅读 14
收藏 5
点赞 0
评论 0

ssh+hadoop+flink+zookeeper+kafka安装记录

2018/6/14----- (当然很多软件不是第一次安装了,治理知识记录一下.)

SSH

  1. ssh-keygen一般用户名什么的我都不填的(一路enter键完事),前提你把改建的用户建好,权限什么的都弄好.(不推荐root用户,但root用户可省略权限什么的)

  2. cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_key

  3. 注意修改/etc/hosts文件

    192.168.199.99 master
    192.168.199.100 slave1
    192.168.199.101 slave2
    

    (给windows系统也改了,这样就可以通过主机名直接访问机器了)

  4. ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@master

  5. ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@slave1

  6. ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@slave2

  7. 测试: ssh slave1,ssh slave2

hadoop

  1. hadoop-env.sh

    export JAVA_HOME=/home/hadoop/hadoop/jdk1.8.0_111
    
  2. yarn-env.sh

    export JAVA_HOME=/home/hadoop/hadoop/jdk1.8.0_111
    

  3. slaves

    192.168.199.99 master
    192.168.199.100 slave1
    192.168.199.101 slave2
    
  4. core-site.xml(需创建一个文件夹)

    <configuration>
            <property>
                    <name>fs.defaultFS</name>
                    <value>hdfs://master:8020</value>
            </property>
    
            <property>
                    <name>hadoop.tmp.dir</name>
                    <value>file:///home/hadoop/hadoop/tmp</value>
                    <description>Abase for other temporary directories.</description>
            </property>
    
            <property>
                    <name>hadoop.proxyuser.hadoop.hosts</name>
                    <value>*</value>
                    <description>hadoop用户可以代理任意机器上的用户</description>
            </property>
    
            <property>
                    <name>hadoop.proxyuser.hadoop.groups</name>
                    <value>*</value>
                    <description>hadoop用户代理任何组下的用户</description>
            </property>
    
            <property>
                    <name>io.file.buffer.size</name>
                    <value>131072</value>
            </property>
    </configuration>
    
  5. hdfs-site.xml(需创建两个文件夹)

    <configuration>
            <property>
                    <name>dfs.namenode.secondary.http-address</name>
                    <value>master:9001</value>
            </property>
    
            <property>
                    <name>dfs.namenode.name.dir</name>
                    <value>file:///home/hadoop/hadoop/namenode</value>
            </property>
    
            <property>
                    <name>dfs.datanode.data.dir</name>
                    <value>file:///home/hadoop/hadoop/datanode</value>
            </property>
    
            <property>
                    <name>dfs.replication</name>
                    <value>3</value>
            </property>
    
            <property>
                    <name>dfs.webhdfs.enabled</name>
                    <value>true</value>
            </property>
    </configuration>
    
  6. mapred-site.xml

    <configuration>
            <property>
                    <name>dfs.namenode.secondary.http-address</name>
                    <value>master:9001</value>
            </property>
    
            <property>
                    <name>dfs.namenode.name.dir</name>
                    <value>file:///home/hadoop/hadoop/namenode</value>
            </property>
    
            <property>
                    <name>dfs.datanode.data.dir</name>
                    <value>file:///home/hadoop/hadoop/datanode</value>
            </property>
    
            <property>
                    <name>dfs.replication</name>
                    <value>3</value>
            </property>
    
            <property>
                    <name>dfs.webhdfs.enabled</name>
                    <value>true</value>
            </property>
    </configuration>
    

  7. yarn-site.xml

    <configuration>
            <property>
                    <name>yarn.nodemanager.aux-services</name>
                    <value>mapreduce_shuffle</value>
            </property>
    
            <property>                                                                
                    <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
                    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
            </property>
    
            <property>
                    <name>yarn.resourcemanager.address</name>
                    <value>master:8032</value>
            </property>
    
            <property>
                    <name>yarn.resourcemanager.scheduler.address</name>
                    <value>master:8030</value>
            </property>
    
            <property>
                    <name>yarn.resourcemanager.resource-tracker.address</name>
                    <value>master:8031</value>
            </property>
    
            <property>
                    <name>yarn.resourcemanager.admin.address</name>
                    <value>master:8033</value>
            </property>
    
            <property>
                    <name>yarn.resourcemanager.webapp.address</name>
                    <value>master:8088</value>
            </property>
    </configuration>
    
    
  8. 然后设置环境变量(可以用/etc/profile,或者~/.bashrc推荐用后者).

    export HADOOP_HOME=/home/hadoop/hadoop/hadoop-2.6.8
    export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
    
    

9.刷新 source ~/.bashrc

  1. 复制到其他节点,并配置相应的环境变量.
scp /home/hadoop/hadoop hadoop@slave1:/home/hadoop/
scp /home/hadoop/hadoop hadoop@slave2:/home/hadoop/
  1. 格式化 hdfs. hdfs namenode -format
  2. 启动: start-dfs.sh,start-yarn.sh
  3. 验证:
    • JPS命令:
      • master:节点有 NameNode,SecondaryNameNode(可以有DataNode).ResourceManager
      • slave:节点有DataNode,NodeManager
    • WebUI:
      • master:8088(activenode为3)

Flink

  1. flink-conf.yaml(注意所有节点的都是这个)

    jobmanager.rpc.address: master
    

  2. master和slaves文件略,写各自的配置就好

  3. 启动: ./bin/start-cluster.sh

  4. 验证: webuimaster:8081

Zookeeper

  1. zoo.cfg(需创建一个文件夹)
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/home/hadoop/zk/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
  1. 在上面创建的目录下用相应的命令输入各自的id

    echo "1" > /home/hadoop/zk/data/myid

  2. 配置全局变量并刷新source ~/.bashrc

    export ZOOKEEPER=/home/hadoop/zk/zookeeper-3.4.12
    export PATH=$PATH:$ZOOKEEPER/bin:$PATH
    
  3. copy到其他机器并刷新.

  4. 依次启动: zkServer.sh start

  5. 验证 : zkServer.sh status查看leader,flower

kafka

  1. server.properties注意

log.dirs=/home/hadoop/kafka/log
host.name=master
port=9092
zookeeper.connect=master:2181,slave1:2181,slave2:2181
  1. 依次copy并修改各自的host.name
  2. 依次启动: ./bin/kafka-server-start.sh ./config/server.properties
  3. 验证:自己建topic,produce,consumer

Flink HA on yarn

  1. flink-conf.xml
################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################


#==============================================================================
# Common
#==============================================================================

env.java.home: /root/hs/java/jdk1.8.0_172
# The external address of the host on which the JobManager runs and can be
# reached by the TaskManagers and any clients which want to connect. This setting
# is only used in Standalone mode and may be overwritten on the JobManager side
# by specifying the --host <hostname> parameter of the bin/jobmanager.sh executable.
# In high availability mode, if you use the bin/start-cluster.sh script and setup
# the conf/masters file, this will be taken care of automatically. Yarn/Mesos
# automatically configure the host name based on the hostname of the node where the
# JobManager runs.
# jobmanager.rpc.address: sccfarmeruat01

# The RPC port where the JobManager is reachable.

jobmanager.rpc.port: 6123


# The heap size for the JobManager JVM

jobmanager.heap.mb: 6192


# The heap size for the TaskManager JVM

taskmanager.heap.mb: 7192


# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.

taskmanager.numberOfTaskSlots: 4

# taskmanager.memory.preallocate:false
# The parallelism used for programs that did not specify and other parallelism.

# parallelism.default: 1

# The default file system scheme and authority.
# 
# By default file paths without scheme are interpreted relative to the local
# root file system 'file:///'. Use this to override the default and interpret
# relative paths relative to a different file system,
# for example 'hdfs://mynamenode:12345'
#
# fs.default-scheme

#==============================================================================
# High Availability
#==============================================================================

# The high-availability mode. Possible options are 'NONE' or 'zookeeper'.
#
 high-availability: zookeeper

# The path where metadata for master recovery is persisted. While ZooKeeper stores
# the small ground truth for checkpoint and leader election, this location stores
# the larger objects, like persisted dataflow graphs.
# 
# Must be a durable file system that is accessible from all nodes
# (like HDFS, S3, Ceph, nfs, ...) 
#
high-availability.storageDir: hdfs:///flink/recovery

# The list of ZooKeeper quorum peers that coordinate the high-availability
# setup. This must be a list of the form:
# "host1:clientPort,host2:clientPort,..." (default clientPort: 2181)
#
high-availability.zookeeper.quorum: sccfarmeruat01:2181,sccfarmeruat02:2181,sccfarmeruat03:2181
high-availability.zookeeper.path.root: /flink


# ACL options are based on https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html#sc_BuiltinACLSchemes
# It can be either "creator" (ZOO_CREATE_ALL_ACL) or "open" (ZOO_OPEN_ACL_UNSAFE)
# The default value is "open" and it can be changed to "creator" if ZK security is enabled
#
# high-availability.zookeeper.client.acl: open

#==============================================================================
# Fault tolerance and checkpointing
#==============================================================================

# The backend that will be used to store operator state checkpoints if
# checkpointing is enabled.
#
# Supported backends are 'jobmanager', 'filesystem', 'rocksdb', or the
# <class-name-of-factory>.
#

# Directory for checkpoints filesystem, when using any of the default bundled
# state backends.
#
# state.checkpoints.dir: hdfs:///flink/checkpoints

# Default target directory for savepoints, optional.
#
# state.savepoints.dir: hdfs://namenode-host:port/flink-checkpoints

# Flag to enable/disable incremental checkpoints for backends that
# support incremental checkpoints (like the RocksDB state backend). 
#
# state.backend.incremental: false

#==============================================================================
# Web Frontend
#==============================================================================

# The address under which the web-based runtime monitor listens.
#
#jobmanager.web.address: 0.0.0.0

# The port under which the web-based runtime monitor listens.
# A value of -1 deactivates the web server.

rest.port: 8081

# Flag to specify whether job submission is enabled from the web-based
# runtime monitor. Uncomment to disable.

#jobmanager.web.submit.enable: false

#==============================================================================
# Advanced
#==============================================================================

# Override the directories for temporary files. If not specified, the
# system-specific Java temporary directory (java.io.tmpdir property) is taken.
#
# For framework setups on Yarn or Mesos, Flink will automatically pick up the
# containers' temp directories without any need for configuration.
#
# Add a delimited list for multiple directories, using the system directory
# delimiter (colon ':' on unix) or a comma, e.g.:
#     /data1/tmp:/data2/tmp:/data3/tmp
#
# Note: Each directory entry is read from and written to by a different I/O
# thread. You can include the same directory multiple times in order to create
# multiple I/O threads against that directory. This is for example relevant for
# high-throughput RAIDs.
#
# io.tmp.dirs: /tmp

# Specify whether TaskManager's managed memory should be allocated when starting
# up (true) or when memory is requested.
#
# We recommend to set this value to 'true' only in setups for pure batch
# processing (DataSet API). Streaming setups currently do not use the TaskManager's
# managed memory: The 'rocksdb' state backend uses RocksDB's own memory management,
# while the 'memory' and 'filesystem' backends explicitly keep data as objects
# to save on serialization cost.
#
taskmanager.memory.preallocate: false

# The classloading resolve order. Possible values are 'child-first' (Flink's default)
# and 'parent-first' (Java's default).
#
# Child first classloading allows users to use different dependency/library
# versions in their application than those in the classpath. Switching back
# to 'parent-first' may help with debugging dependency issues.
#
# classloader.resolve-order: child-first

# The amount of memory going to the network stack. These numbers usually need 
# no tuning. Adjusting them may be necessary in case of an "Insufficient number
# of network buffers" error. The default min is 64MB, teh default max is 1GB.
# 
# taskmanager.network.memory.fraction: 0.1
# taskmanager.network.memory.min: 67108864
# taskmanager.network.memory.max: 1073741824
fs.hdfs.hadoopconf: /root/hs/hadoop/hadoop-2.8.3/etc/hadoop/
#==============================================================================
# Flink Cluster Security Configuration
#==============================================================================

# Kerberos authentication for various components - Hadoop, ZooKeeper, and connectors -
# may be enabled in four steps:
# 1. configure the local krb5.conf file
# 2. provide Kerberos credentials (either a keytab or a ticket cache w/ kinit)
# 3. make the credentials available to various JAAS login contexts
# 4. configure the connector to use JAAS/SASL

# The below configure how Kerberos credentials are provided. A keytab will be used instead of
# a ticket cache if the keytab path and principal are set.

# security.kerberos.login.use-ticket-cache: true
# security.kerberos.login.keytab: /path/to/kerberos/keytab
# security.kerberos.login.principal: flink-user

# The configuration below defines which JAAS login contexts

# security.kerberos.login.contexts: Client,KafkaClient

#==============================================================================
# ZK Security Configuration
#==============================================================================

# Below configurations are applicable if ZK ensemble is configured for security

# Override below configuration to provide custom ZK service name if configured
# zookeeper.sasl.service-name: zookeeper

# The configuration below must match one of the values set in "security.kerberos.login.contexts"
# zookeeper.sasl.login-context-name: Client

#==============================================================================
# HistoryServer
#==============================================================================

# The HistoryServer is started and stopped via bin/historyserver.sh (start|stop)

# Directory to upload completed jobs to. Add this directory to the list of
# monitored directories of the HistoryServer as well (see below).
#jobmanager.archive.fs.dir: hdfs:///completed-jobs/

# The address under which the web-based HistoryServer listens.
#historyserver.web.address: 0.0.0.0

# The port under which the web-based HistoryServer listens.
#historyserver.web.port: 8082

# Comma separated list of directories to monitor for completed jobs.
#historyserver.archive.fs.dir: hdfs:///completed-jobs/

# Interval in milliseconds for refreshing the monitored directories.
#historyserver.archive.fs.refresh-interval: 10000
yarn.application-attempts: 10
  1. zoo.cfg

    # ZooKeeper quorum peers
    server.1=sccfarmeruat01:2888:3888
    server.2=sccfarmeruat02:2888:3888
    server.3=sccfarmeruat03:2888:3888
    
  2. 运行:start-zookeeper-quorum.sh

  3. 运行:yarn-session.sh

  4. kill掉YarnSessionClusterEntrypoint,发现hadoop会自动在一台机器上重启这个服务。

© 著作权归作者所有

共有 人打赏支持
xd03122049
粉丝 7
博文 72
码字总数 47963
作品 0
西安
程序员

暂无相关文章

Linux中的端口大全

1 被LANA定义的端口 端口 名称 描述 1 tcpmux TCP 端口服务多路复用 5 rje 远程作业入口 7 echo Echo 服务 9 discard 用于连接测试的空服务 11 systat 用于列举连接了的端口的系统状态 13 d...

寰宇01 ⋅ 14分钟前 ⋅ 0

Confluence 6 如何备份存储文件和页面信息

备份的 ZIP 文件包含有 entities.xml,这个 XML 文件包含有 Confluence 的所有页面内容和存储附件的目录。 备份 Zip 文件结构 页面的附件是存储在附件存储目录中的,通过页面和附件 ID 进行识...

honeymose ⋅ 17分钟前 ⋅ 0

【每天一个JQuery特效】根据状态确定是否滑入或滑出被选元素

主要效果: 本文主要采用slideToggle()方法实现以一行代码同时实现以展开或收缩的方式显示或隐藏被选元素。 主要代码如下: <!DOCTYPE html><html><head><meta charset="UTF-8">...

Rhymo-Wu ⋅ 21分钟前 ⋅ 0

度量.net framework 迁移到.net core的工作量

把现有的.net framework程序迁移到.net core上,是一个非常复杂的工作,特别是一些API在两个平台上还不能同时支持。两个类库的差异性,通过人工很难识别全。好在微软的工程师们考虑到了我们顾...

李朝强 ⋅ 26分钟前 ⋅ 0

请不要在“微服务”的狂热中迷失自我!

微服务在过去几年一直是一个非常热门的话题(附录1)。何为“微服务的疯狂”,举个例子: 众所周知,Netflix在DevOps上的表现非常棒。Netfix可以做微服务。因此:如果我做微服务,我也将非常...

harries ⋅ 27分钟前 ⋅ 0

oAuth2 升级Spring Cloud Finchley.RELEASE踩坑分享

背景 6.19号,spring团队发布了期待已久的 Spring Cloud Finchley.RELEASE 版本。 重要变化: 基于Spring Boot 2.0.X 不兼容 Spring Boot 1.5.X 期间踩过几个坑,分享出来给大伙,主要是关于...

冷冷gg ⋅ 57分钟前 ⋅ 0

OSChina 周一乱弹 —— 理发师小姐姐的魔法

Osc乱弹歌单(2018)请戳(这里) 【今日歌曲】 @冰冰棒- :分享田馥甄的单曲《My Love》 《My Love》- 田馥甄 手机党少年们想听歌,请使劲儿戳(这里) @Li-Wang :哎,头发又长了。。。又要...

小小编辑 ⋅ 今天 ⋅ 8

Kafka1.0.X_消费者API详解2

偏移量由消费者管理 kafka Consumer Api还提供了自己存储offset的功能,将offset和data做到原子性,可以让消费具有Exactly Once 的语义,比kafka默认的At-least Once更强大 消费者从指定分区...

特拉仔 ⋅ 今天 ⋅ 0

NEO智能合约之发布和升级(二)

接NEO智能合约之发布和升级(一),我们接下来说说智能合约的升级功能。 一 准备工作 合约的升级需要在合约内预先设置好升级接口,以方便在升级时调用。接下来我们对NEO智能合约之发布和升级...

红烧飞鱼 ⋅ 今天 ⋅ 0

个人博客的运营模式能否学习TMALL天猫质量为上?

心情随笔|个人博客的运营模式能否学习TMALL天猫质量为上? 中国的互联网已经发展了很多年了,记得在十年前,个人博客十分流行,大量的人都在写博客,而且质量还不错,很多高质量的文章都是在...

原创小博客 ⋅ 今天 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部