GithubHelp home page GithubHelp logo

xxxx001 / nnproxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bytedance/nnproxy

0.0 0.0 0.0 37 KB

Scalable NameNode RPC Proxy for HDFS Federation

Home Page: http://bytedance.com

License: Apache License 2.0

Shell 1.35% Java 98.65%

nnproxy's Introduction

NameNodeProxy

Another HDFS Federation solution from bytedance.

Features

  • NameNode RPC proxy instead of ViewFS, no client-side changes.
  • Multiple language client (i.e. snakebite) support.
  • Stateless. Easy to scale to multiple instances.
  • High throughput with little latency introduced.
  • Request throttle. Single NameNode malfunction will not affect globally.

Compared with ViewFS and WebHDFS:

NNProxyViewFSWebHDFS
Multiple language supportYesNoYes
Unified APIs providedYesYesNo
Mount table stored inZookeeperConfigurationConfiguration
* Client-side configurations are not usually easy to change
Client-side libraryNoHeavyLight
Call latency introducedMediumNo latencyHigh
Centralized cache supportYesYesNo

Benchmark

Benchmark result with NameNode Benchmark 0.4:

Direct TPSNNProxy TPS (3 proxy instances)
create_write @ 16maps263,294247,799
create_write @ 128maps3,008,6042,563,465
rename @ 128maps474,671471,240
(numOfFiles 512 each map, NameNode CPU: Xeon E5-2630 v2 * 2, network RTT 0.1ms)

Build

IMPORTANT: NNProxy works only with patched NameNode. See /hadoop-patches in git repository. These patches add proxy support to hadoop-common library. Each of them must be applied before compiling.

Build with maven:

$ cd nnproxy/hadoop-nnproxy
$ mvn package -DskipTests

Built jar are shaded with necessary libraries, which can run with hadoop jar.

Deploy

Organize working directory as follows:

bin/
bin/nnproxy
lib/
lib/hadoop-nnproxy-0.1.0.jar

Then run bin/nnproxy with configuration arguments to start proxy server. Note that before starting proxy server, a mount table must be deployed first.

For example:

# Setup zk environment, for simplicity, not necessary
export NNPROXY_ZK_QUORUM="127.0.0.1:2181"
export NNPROXY_MOUNT_TABLE_ZKPATH="/hadoop/hdfs/mounts"

export NNPROXY_OPTS="-Ddfs.nnproxy.mount-table.zk.quorum=$NNPROXY_ZK_QUORUM -Ddfs.nnproxy.mount-table.zk.path=$NNPROXY_MOUNT_TABLE_ZKPATH"

# Deploy mount table, example above mounts / to hdfs://toutiaonn0 and /data 
# to hdfs://toutiaonn1. In which case, accessing /data/recommend would be 
# transparently redirected to hdfs://toutiaonn1/data/recommend.
# In this example, toutiaonn0 and toutiaonn1 are fs names configured with 
# auto failover HA. Using ip:port directly (non-HA setup) are also fesible.
echo 'hdfs://toutiaonn0 /' > mounts
echo 'hdfs://toutiaonn1 /data' >> mounts
cat mounts | bin/nnproxy load $NNPROXY_OPTS

# Run proxy (remember these args)
bin/nnproxy proxy $NNPROXY_OPTS

Look into class com.bytedance.hadoop.hdfs.ProxyConfig for more configurations available.

Proxy server metrics are also available with hadoop-metrics2.

Mount table management

Once proxy server is started, it watches mount table node on ZooKeeper for further changes.

Run bin/nnproxy dump $NNPROXY_OPTS to dump current mount table to stdout.

Run bin/nnproxy load $NNPROXY_OPTS to load mount table from stdin.

One can also alter data stored in mount table ZK node directly (or possibly build APIs or UIs). All these changes take effect immediately.

Mount table are delimited text with 3 columns: targetFS, path and attributes, in that order. For example:

hdfs://toutiaonn0   /        none
hdfs://toutiaonn1   /data    none

Each row advises proxy to redirect path and its children to specified targetFS. attributes are currently reserved and is of no use.

Future work

  • Support readonly attribute in mounts
  • More kind of operations through proxy

License

Copyright 2016 Bytedance Inc.

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.

nnproxy's People

Contributors

tesseract2048 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.