【background】
Hadoop did not engage in several years, and recently needed Flink, we intend to engage in a practice Flink On Yarn.
Below this is the note of a few years ago to install HBase, Hadoop also includes installation.
https://www.cnblogs.com/quchunhui/p/7411389.html
The plan to choose whether to install the latest version of the successful attempt.
【surroundings】
jdk:jdk-8u77-linux-x64.tar.gz
zookeeper:zookeeper-3.4.6.tar.gz
hadoop:hadoop-2.10.0.tar.gz
nimble: nimble-1.10.0-bin scala_2.11.tgz
【system】
Linux CentOS8 (ECS Ali cloud server)
Hostname are three nodes:
rexel-ids001
rexel-ids002
rexel-ids003
[Install JDK]
Has been installed, the recording will not be repeated here.
JAVA_HOME=/home/radmin/jdk1.8.0_77
[Installation] zookeeper
Has been installed, the recording will not be repeated here.
ZK_HOME=/home/radmin/zookeeper-3.5.6
[Installation] Hadoop
== decompress and configuration environment variable ==
HADOOP_HOME=/home/radmin/hadoop-2.10.1
Modify the configuration file == ==
Configuration file, all nodes in the same configuration file. It may be performed after a node, configured, and replicated to other nodes using ssh command.
hadoop-env.sh
core-site.xml
hdfs-site.xml
mapred-site.xml
yarn-site.xml
masters
slaves
hadoop-env.sh
export JAVA_HOME=/home/radmin/jdk1.8.0_77
core-site.xml
<configuration> <property> <name>hadoop.tmp.dir</name> <value>/home/radmin/data/hadoop/tmp</value> </property> <property> <name>fs.defaultFS</name> <value>hdfs://ns</value> </property> <property> <name>dfs.journalnode.edits.dir</name> <value>/home/radmin/data/hadoop/journal</value> </property> <property> <name>ha.zookeeper.quorum</name> <value>rexel-ids001:2181, Rexel-ids003:2181, Rexel-ids002:In 2181</value> </property> </configuration>
hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>/home/radmin/data/hadoop/hdfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>/home/radmin/data/hadoop/hdfs/data</value> </property> <property> <name>dfs.permissions</name> <value>false</value> </property> <property> <name>dfs.nameservices</name> <value>ns</value> </property> <property> <name>dfs.ha.namenodes.ns</name> <value>nn1,nn2</value> </property> <property> <name>dfs.namenode.rpc-address.ns.nn1</name> <value>rexel-ids001:9000</value> </property> <property> <name>dfs.namenode.rpc-address.ns.nn2</name> <value>rexel-ids002:9000</value> </property> <property> <name>dfs.namenode.http-address.ns.nn1</name> <value>rexel-ids001:50070</value> </property> <property> <name>dfs.namenode.http-address.ns.nn2</name> <value>rexel-ids002:50070</value> </property> <property> <name>dfs.namenode.shared.edits.dir</name> <value>qjournal://rexel-ids001:8485;rexel-ids002:8485;rexel-ids003:8485/ns</value> </property> <property> <name>dfs.ha.automatic-failover.enabled.ns</name> <value>true</value> </property> <property> <name>dfs.client.failover.proxy.provider.ns</name> <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value> </property> <property> <name>dfs.ha.fencing.methods</name> <value>sshfence</value> </property> <property> <name>dfs.ha.fencing.ssh.private-key-files</name> <value>~/.ssh/id_rsa</value> </property> </configuration>
mapred-site.xml
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.reduce.memory.mb</name> <value>54</value> </property> <property> <name>mapreduce.map.memory.mb</name> <value>128</value> </property> </configuration>
yarn-site.xml
<configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.ha.enabled</name> <value>true</value> </property> <property> <name>yarn.nodemanager.vmem-check-enabled</name> <value>false</value> </property> <property> <name>yarn.resourcemanager.cluster-id</name> <value>ns</value> </property> <property> <name>yarn.resourcemanager.ha.rm-ids</name> <value>rm1,rm2</value> </property> <property> <name>yarn.resourcemanager.hostname.rm1</name> <value>rexel-ids001</value> </property> <property> <name>yarn.resourcemanager.hostname.rm2</name> <value>rexel-ids002</value> </property> <property> <name>yarn.resourcemanager.webapp.address.rm1</name> <value>rexel-ids001:8088</value> </property> <property> <name>yarn.resourcemanager.webapp.address.rm2</name> <value>rexel-ids002:8088</value> </property> <property> <name>yarn.resourcemanager.zk-address</name> <value>rexel-ids001:2181,rexel-ids002:2181,rexel-ids003:2181</value> </property> <property> <name>yarn.resourcemanager.recovery.enabled</name> <value>true</value> </property> <property> <name>yarn.resourcemanager.store.class</name> <value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>512</value> </property> <property> <name>yarn.scheduler.minimum-allocation-mb</name> <value>128</value> </property> <property> <name>yarn.scheduler.maximum-allocation-mb</name> <value>512</value> </property>
<property>
<name>yarn.resourcemanager.am.max-attempts</name>
<value>4</value>
<description>The maximum number of application master execution attempts.</description>
</property>
</configuration>
Yarn.resourcemanager.am.max-attempts which prompted this configuration is modified according to the official website Flink.
masters
If not, you need to manually create the file>
rexel- ids001
Rexel -ids002
slaves
rexel- ids001 Rexel - ids002 Rexel -ids003
== == first start
1) in the rexel-ids001
hdfs zkfc -formatZK
2) Node 3 were started:
hadoop-daemon.sh start journalnode
3) On rexel-ids001:
hdfs namenode -format
hadoop-daemon.sh start namenode
4) On rexel-ids002:
hdfs namenode -bootstrapStandby
hadoop-daemon.sh start namenode
5) and on rexel-ids001 rexel-ids002:
hadoop-daemon.sh start zkfc
6) Start 3 nodes respectively:
hadoop-daemon.sh start datanode
7) and on rexel-ids001 rexel-ids002:
yarn-daemon.sh start resourcemanager
8) were started three nodes:
yarn-daemon.sh start nodemanager
9) starts on dscn1:
mr-jobhistory-daemon.sh start historyserver
Daily Startup == ==
1) 3 were started node:
hadoop-daemon.sh start journalnode
2) in the 1 and 2:
hadoop-daemon.sh start namenode
3) in the 1 and 2:
hadoop-daemon.sh start zkfc
4) Start 3 nodes respectively:
hadoop-daemon.sh start datanode
5) and on 1 d2:
yarn-daemon.sh start resourcemanager
6) Start 3 nodes respectively:
yarn-daemon.sh start nodemanager
7) started on 1:
mr-jobhistory-daemon.sh start historyserver
[Installation] Flink
== == Download and configuration environment variable
== == Profile
Reference example can be provided by the official website
https://ci.apache.org/projects/flink/flink-docs-release-1.10/ops/jobmanager_high_availability.html
Related profiles:
flink-conf.yaml
masters
slaves
zoo.cfg
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 #============================================================================== # 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: rexel-ids001 # The RPC port where the JobManager is reachable. jobmanager.rpc.port: 6123 # The heap size for the JobManager JVM jobmanager.heap.size: 512m # The total process memory size for the TaskManager. # # Note this accounts for all memory usage within the TaskManager process, including JVM metaspace and other overhead. taskmanager.memory.process.size: 1024m # To exclude JVM metaspace and overhead, please, use total Flink memory size instead of 'taskmanager.memory.process.size'. # It is not recommended to set both 'taskmanager.memory.process.size' and Flink memory. # taskmanager.memory.flink.size: 512m # The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline. taskmanager.numberOfTaskSlots: 4 # 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://ns/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: rexel-ids001:2181,rexel-ids002:2181,rexel-ids003:2181 # 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 high-availability.zookeeper.path.root: /flink #============================================================================== # 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>. # state.backend: filesystem # Directory for checkpoints filesystem, when using any of the default bundled # state backends. # state.checkpoints.dir: hdfs://ns/flink/checkpoints # Default target directory for savepoints, optional. # state.savepoints.dir: hdfs://ns/flink/savepoints # Flag to enable/disable incremental checkpoints for backends that # support incremental checkpoints (like the RocksDB state backend). # # state.backend.incremental: false # The failover strategy, i.e., how the job computation recovers from task failures. # Only restart tasks that may have been affected by the task failure, which typically includes # downstream tasks and potentially upstream tasks if their produced data is no longer available for consumption. jobmanager.execution.failover-strategy: region #============================================================================== # Rest & web frontend #============================================================================== # The port to which the REST client connects to. If rest.bind-port has # not been specified, then the server will bind to this port as well. # rest.port: 9081 # The address to which the REST client will connect to # #rest.address: 0.0.0.0 # Port range for the REST and web server to bind to. # #rest.bind-port: 8080-8090 # The address that the REST & web server binds to # #rest.bind-address: 0.0.0.0 # Flag to specify whether job submission is enabled from the web-based # runtime monitor. Uncomment to disable. 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: /home/radmin/data/flink/tmp env.log.dir: /home/radmin/data/flink/logs # 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, the default max is 1GB. # taskmanager.memory.network.fraction: 0.1 taskmanager.memory.network.min: 64mb taskmanager.memory.network.max: 1gb fs.hdfs.hadoopconf: /home/radmin/hadoop-2.10.0/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://ns/flink/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://ns/flink/completed_jobs/ # Interval in milliseconds for refreshing the monitored directories. historyserver.archive.fs.refresh-interval: 10000
masters
Rexel-ids001: 8081 Rexel -ids002: 8081
slaves
rexel- ids001 Rexel - ids002 Rexel -ids003
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.
dataDir=/home/radmin/data/zk/dataDir
dataLogDir=/home/radmin/data/zk/dataLogDir
# The port at which the clients will connect
clientPort=2181
# ZooKeeper quorum peers
server.0=rexel-ids001:2888:3888
server.1=rexel-ids002:2888:3888
server.2=rexel-ids003:2888:3888
== == cluster startup
Start command: ./ start-cluster.sh
[Episode 1]
When activated, the following error occurred
Starting HA cluster with 2 masters. Starting standalonesession daemon on host rexel-ids001. Starting standalonesession daemon on host rexel-ids002. [ERROR] Could not get JVM parameters properly. [ERROR] Could not get JVM parameters properly. [ERROR] Could not get JVM parameters properly.
The specific reasons are not clear, but after flink-conf.xml commented out in the following configuration items, an error is not prompt.
taskmanager.memory.process.size: 1024m taskmanager.memory.network.fraction: 0.1 taskmanager.memory.network.min: 64mb taskmanager.memory.network.max: 1gb
[Episode 2]
We found the following errors in the startup log:
2020-03-12 12:42:04,933 INFO org.apache.flink.configuration.GlobalConfiguration - Loading configuration property: parallelism.default, 1 2020-03-12 12:42:04,933 INFO org.apache.flink.configuration.GlobalConfiguration - Loading configuration property: jobmanager.execution.failover-strategy, region 2020-03-12 12:42:04,936 WARN org.apache.flink.client.cli.CliFrontend - Could not load CLI class org.apache.flink.yarn.cli.FlinkYarnSessionCli. java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/exceptions/YarnException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLine(CliFrontend.java:1076) at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLines(CliFrontend.java:1030) at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:957) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.exceptions.YarnException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 5 more 2020-03-12 12:42:05,028 INFO org.apache.flink.core.fs.FileSystem - Hadoop is not in the classpath/dependencies. The extended set of supported File Systems via Hadoop is not available. 2020-03-12 12:42:05,057 INFO org.apache.flink.runtime.security.modules.HadoopModuleFactory - Cannot create Hadoop Security Module because Hadoop cannot be found in the Classpath. 2020-03-12 12:42:05,069 INFO org.apache.flink.runtime.security.modules.JaasModule - Jaas file will be created as /tmp/jaas-5195639153293838170.conf. 2020-03-12 12:42:05,071 INFO org.apache.flink.runtime.security.SecurityUtils - Cannot install HadoopSecurityContext because Hadoop cannot be found in the Classpath.
The following tips can refer to the official website of Flink
https://ci.apache.org/projects/flink/flink-docs-release-1.10/ops/deployment/hadoop.html
The solution is to increase the environment variable
export HADOOP_CLASSPATH=`hadoop classpath`
[Episode 3]
After the cluster is up, after a while jps view flink process, discovery process does not exist.
View the boot log found the following errors:
2020-03-12 14:12:07,474 ERROR org.apache.flink.runtime.taskexecutor.TaskManagerRunner - TaskManager initialization failed. java.io.IOException: Could not create FileSystem for highly available storage path (hdfs://ns/flink/recovery/default) at org.apache.flink.runtime.blob.BlobUtils.createFileSystemBlobStore(BlobUtils.java:103) at org.apache.flink.runtime.blob.BlobUtils.createBlobStoreFromConfig(BlobUtils.java:89) at org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils.createHighAvailabilityServices(HighAvailabilityServicesUtils.java:125) at org.apache.flink.runtime.taskexecutor.TaskManagerRunner.<init>(TaskManagerRunner.java:132) at org.apache.flink.runtime.taskexecutor.TaskManagerRunner.runTaskManager(TaskManagerRunner.java:308) at org.apache.flink.runtime.taskexecutor.TaskManagerRunner.lambda$runTaskManagerSecurely$2(TaskManagerRunner.java:322) at org.apache.flink.runtime.security.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30) at org.apache.flink.runtime.taskexecutor.TaskManagerRunner.runTaskManagerSecurely(TaskManagerRunner.java:321) at org.apache.flink.runtime.taskexecutor.TaskManagerRunner.main(TaskManagerRunner.java:287) Caused by: org.apache.flink.core.fs.UnsupportedFileSystemSchemeException: Could not find a file system implementation for scheme 'hdfs'. The scheme is not directly supported by Flink and no Hadoop file system to support this scheme could be loaded. at org.apache.flink.core.fs.FileSystem.getUnguardedFileSystem(FileSystem.java:450) at org.apache.flink.core.fs.FileSystem.get(FileSystem.java:362) at org.apache.flink.core.fs.Path.getFileSystem(Path.java:298) at org.apache.flink.runtime.blob.BlobUtils.createFileSystemBlobStore(BlobUtils.java:100) ... 8 more Caused by: org.apache.flink.core.fs.UnsupportedFileSystemSchemeException: Hadoop is not in the classpath/dependencies. at org.apache.flink.core.fs.UnsupportedSchemeFactory.create(UnsupportedSchemeFactory.java:58) at org.apache.flink.core.fs.FileSystem.getUnguardedFileSystem(FileSystem.java:446) ... 11 more
After referring to this fellow blog. Blog: https://my.oschina.net/u/2338224/blog/3101005
Find the corresponding jar package on to the following Web site, sad reminder of the results found no Flink1.10 and hadoop2.10.0
https://repo.maven.apache.org/maven2/org/apache/flink/flink-shaded-hadoop-2-uber/
How to do? Explore the use of 2.8.3-10.0 try it? Hadoop or to switch to the 2.8.3 version of it? First tried to pack into them
After the re-run ./start-cluster.sh, fortunately Flink cluster normal start up.
I can see these two processes have been in, log nor the above error.
Start the Web page == ==
Web pages port number is 8081.
See this page is really very happy. After all, it is not very easy. (To play a tribal conflict, to celebrate.)