-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-18682. Move hadoop docker scripts under the main source code #6483
Open
xBis7
wants to merge
9
commits into
apache:trunk
Choose a base branch
from
xBis7:HADOOP-18682
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+322
−0
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e32667c
Move hadoop docker scripts under the main source code
xBis7 a18a2fb
remove space
xBis7 5810004
add README license
xBis7 464c378
fix CI Dockerfile error
xBis7 03d600f
HadoopDocker.md
xBis7 83ad1a3
Merge remote-tracking branch 'origin/trunk' into HADOOP-18682
xBis7 e9a25c6
fix Dockerfile ci error
xBis7 1343de8
update README + change hadoop-runner version
xBis7 08987d1
update HadoopDocker.md
xBis7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
hadoop-common-project/hadoop-common/src/site/markdown/HadoopDocker.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!--- | ||
Licensed 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. See accompanying LICENSE file. | ||
--> | ||
|
||
## Hadoop Docker | ||
|
||
### Official releases | ||
|
||
There are special branches for running specific hadoop version in docker. | ||
These branches, use the files from official hadoop releases for running hadoop inside the containers. | ||
|
||
E.g. | ||
* [docker-hadoop-runner-latest](https:/apache/hadoop/tree/docker-hadoop-runner-latest) | ||
* [docker-hadoop-runner-jdk11](https:/apache/hadoop/tree/docker-hadoop-runner-jdk11) | ||
* [docker-hadoop-runner-jdk8](https:/apache/hadoop/tree/docker-hadoop-runner-jdk8) | ||
* [docker-hadoop-runner](https:/apache/hadoop/tree/docker-hadoop-runner) | ||
* [docker-hadoop-3](https:/apache/hadoop/tree/docker-hadoop-3) | ||
* [docker-hadoop-2](https:/apache/hadoop/tree/docker-hadoop-2) | ||
|
||
### Source code | ||
|
||
There is a setup under `hadoop-dist` that contains Docker Compose definitions | ||
for running the current version of Hadoop in a multi-node docker environment. | ||
|
||
This is meant for testing code changes locally and debugging. | ||
|
||
The base image used by the Docker setup is built as part of the maven lifecycle. | ||
The distribution files generated while building the project with the `-Pdist` profile enabled, | ||
will be used for running hadoop inside the containers. | ||
|
||
In order to start the docker environment you need to do the following | ||
* Build the project, using the `-Pdist` profile | ||
```shell | ||
> mvn clean install -Dmaven.javadoc.skip=true -DskipTests -DskipShade -Pdist,src | ||
``` | ||
* From the project root, navigate under the docker-compose dir under the generated dist directory | ||
```shell | ||
> cd hadoop-dist/target/hadoop-<current-version>/compose/hadoop | ||
``` | ||
* Start the docker environment | ||
```shell | ||
> docker-compose up -d --scale datanode=3 | ||
``` | ||
* Connect to a container to execute commands | ||
```shell | ||
> docker exec -it hadoop_datanode_1 bash | ||
bash-4.2$ hdfs dfs -mkdir /test | ||
``` | ||
|
||
### Config files | ||
|
||
To add or remove properties from the `core-site.xml`, `hdfs-site.xml`, etc. files used in the docker environment, | ||
simply edit the `config` file before starting the containers. The changes will be persisted in the docker environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 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. | ||
|
||
HADOOP_IMAGE=apache/hadoop | ||
HADOOP_RUNNER_VERSION=${docker.hadoop-runner.version} | ||
HADOOP_RUNNER_IMAGE=apache/hadoop-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 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. | ||
|
||
CORE-SITE.XML_fs.default.name=hdfs://namenode | ||
CORE-SITE.XML_fs.defaultFS=hdfs://namenode | ||
|
||
HDFS-SITE.XML_dfs.namenode.rpc-address=namenode:8020 | ||
HDFS-SITE.XML_dfs.replication=1 | ||
|
||
MAPRED-SITE.XML_mapreduce.framework.name=yarn | ||
MAPRED-SITE.XML_yarn.app.mapreduce.am.env=HADOOP_MAPRED_HOME=$HADOOP_HOME | ||
MAPRED-SITE.XML_mapreduce.map.env=HADOOP_MAPRED_HOME=$HADOOP_HOME | ||
MAPRED-SITE.XML_mapreduce.reduce.env=HADOOP_MAPRED_HOME=$HADOOP_HOME | ||
|
||
YARN-SITE.XML_yarn.resourcemanager.hostname=resourcemanager | ||
YARN-SITE.XML_yarn.nodemanager.pmem-check-enabled=false | ||
YARN-SITE.XML_yarn.nodemanager.delete.debug-delay-sec=600 | ||
YARN-SITE.XML_yarn.nodemanager.vmem-check-enabled=false | ||
YARN-SITE.XML_yarn.nodemanager.aux-services=mapreduce_shuffle | ||
|
||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.maximum-applications=10000 | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.maximum-am-resource-percent=0.1 | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.resource-calculator=org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.queues=default | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.default.capacity=100 | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.default.user-limit-factor=1 | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.default.maximum-capacity=100 | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.default.state=RUNNING | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.default.acl_submit_applications=* | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.root.default.acl_administer_queue=* | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.node-locality-delay=40 | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.queue-mappings= | ||
CAPACITY-SCHEDULER.XML_yarn.scheduler.capacity.queue-mappings-override.enable=false | ||
|
||
LOG4J.PROPERTIES_log4j.rootLogger=INFO, stdout | ||
LOG4J.PROPERTIES_log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
LOG4J.PROPERTIES_log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
LOG4J.PROPERTIES_log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 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. | ||
|
||
version: "3.8" | ||
|
||
x-common-config: | ||
&common-config | ||
image: ${HADOOP_RUNNER_IMAGE}:${HADOOP_RUNNER_VERSION} | ||
volumes: | ||
- ../..:/opt/hadoop | ||
env_file: | ||
- ./config | ||
|
||
services: | ||
namenode: | ||
<<: *common-config | ||
hostname: namenode | ||
command: ["hdfs", "namenode"] | ||
ports: | ||
- 9870:9870 | ||
environment: | ||
ENSURE_NAMENODE_DIR: "/tmp/hadoop-root/dfs/name" | ||
datanode: | ||
<<: *common-config | ||
command: ["hdfs", "datanode"] | ||
resourcemanager: | ||
<<: *common-config | ||
hostname: resourcemanager | ||
command: ["yarn", "resourcemanager"] | ||
ports: | ||
- 8088:8088 | ||
nodemanager: | ||
<<: *common-config | ||
command: ["yarn", "nodemanager"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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. | ||
|
||
FROM apache/hadoop-runner:@docker.hadoop-runner.version@ | ||
|
||
COPY . /opt/hadoop | ||
|
||
WORKDIR /opt/hadoop | ||
|
||
USER root | ||
|
||
RUN chown -R hadoop:users /opt/hadoop | ||
|
||
USER hadoop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
docker-hadoop-runner*
images are not related to any specific Hadoop version. They are just the base images for running any Hadoop version.