Skip to content

milenkovicm/testcontainers-minidfs-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Opinionated Single Node HDFS Cluster Testcontainer

github action Crates.io Crates.io

Opinionated single node HDFS (DFS) cluster captured in a testcontainer.

testcontainers-minidfs-rs = "0.4"
testcontainers = "0.18"

Example:

use testcontainers::runners::AsyncRunner;
use testcontainers_minidfs_rs::*;

#[tokio::main]
async fn main() {

    let container = MiniDFS::runnable();
    let server_node = container.start().await.unwrap();

    let hdfs_namenode_url = format!("hdfs://{}:{}/", "localhost", server_node.get_host_port_ipv4(PORT_NAME_NODE).await.unwrap());
}

HDFS name node should be available at hdfs://localhost:9000 and name node http at http://localhost:8020.

Kerberos Support

MiniHDFS can be configured with kerberos support:

use testcontainers::runners::AsyncRunner;
use testcontainers_minidfs_rs::*;

#[tokio::main]
async fn main() {
    let container = MiniDFS::builder().with_kerberos(true).build();
    let server_node = container.start().await;
}

MiniDFS will be configured to support kerberos and all required files will be exposed as a docker volume mounted in the target directory.

use testcontainers::runners::AsyncRunner;
use testcontainers_minidfs_rs::*;

let container = MiniDFS::builder().with_kerberos(true).build();
// pre-populated kerberos cache file (ccache)
let kerberos_cache = container.image().kerberos_cache();
// kerberos configuration file krb5.conf
let kerberos_config = container.image().kerberos_config();
// hadoop configuration core-site.xml
let hdfs_config = container.image().hdfs_config();

All required files needed for hdfs client setup are exposed. (kinit will be executed by the container, kerberos cache will be produced).

Limitations

  • Ports are hardcoded, thus only single instance per host is possible
  • Not many configuration option can be tunned