本文共 3872 字,大约阅读时间需要 12 分钟。
Apache Accumulo 是一款开源分布式 NoSQL 数据库,基于谷歌 Bigtable 的构建而成。它能够高效处理大规模数据集,支持 CRUD 操作,并在单元级访问控制层提供细粒度安全性。Accumulo 依赖于 Apache HDFS 和 ZooKeeper 进行存储和同步。以下将详细介绍如何在 Ubuntu 14.04 上安装并配置一个功能友好的 Accumulo 实例。
Accumulo、HDFS 和 ZooKeeper 都基于 Java 运行,因此首先需要安装 JDK 7。
sudo apt-get updatesudo apt-get install openjdk-7-jdk
编辑 ~/.bashrc 文件,添加 JAVA_HOME 环境变量:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
保存后执行:
. ~/.bashrc
编辑 JVM 安全配置文件:
sudo nano $JAVA_HOME/jre/lib/security/java.security
添加以下参数以优化 JVM 启动时间:
securerandom.source=file:/dev/./urandom
保存并退出。
Hadoop 和 Accumulo 需要 SSH 进行远程接口管理。
sudo apt-get install ssh rsync
确保 Hadoop 能够无密码通过 SSH 连接到服务器。
ssh-keygen -P ''
将公钥添加到 ~/.ssh/authorized_keys:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
添加 localhost 和 0.0.0.0 到已知主机列表:
ssh localhostssh 0.0.0.0
退出 SSH 会话:
exit
创建一个 Downloads 目录以存储必要文件。
mkdir -p ~/Downloadscd ~/Downloads
下载 Hadoop 最新稳定版本:
wget http://www.eu.apache.org/dist/hadoop/common/stable/hadoop-2.6.0.tar.gz
下载最新稳定版本:
wget http://www.eu.apache.org/dist/zookeeper/stable/zookeeper-3.4.6.tar.gz
下载最新稳定版本:
wget http://www.eu.apache.org/dist/accumulo/1.6.1/accumulo-1.6.1-bin.tar.gz
创建一个 Installs 目录来存储所有安装文件。
mkdir -p ~/Installscd ~/Installs
解压 Hadoop 文件并配置环境变量。
tar -xvzf ~/Downloads/hadoop-2.6.0.tar.gz
编辑 hadoop-env.sh:
nano ~/Installs/hadoop-2.6.0/etc/hadoop/hadoop-env.sh
添加 JAVA_HOME 和 HADOOP_OPTS:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386export HADOOP_OPTS="$HADOOP_OPTS -XX:-PrintWarnings -Djava.net.preferIPv4Stack=true"
编辑 core-site.xml:
nano ~/Installs/hadoop-2.6.0/etc/hadoop/core-site.xml
添加以下配置:
fs.defaultFS hdfs://localhost:9000
编辑 hdfs-site.xml:
nano ~/Installs/hadoop-2.6.0/etc/hadoop/hdfs-site.xml
添加以下配置:
dfs.replication 1 dfs.name.dir hdfs_storage/name dfs.data.dir hdfs_storage/data
创建 mapred-site.xml:
nano ~/Installs/hadoop-2.6.0/etc/hadoop/mapred-site.xml
添加以下配置:
mapred.job.tracker localhost:9001
启动 Hadoop 命名节点:
cd ~/Installs/hadoop-2.6.0/~/Installs/hadoop-2.6.0/bin/hdfs namenode -format~/Installs/hadoop-2.6.0/sbin/start-dfs.sh
解压 ZooKeeper 文件并配置环境变量。
tar -xvzf ~/Downloads/zookeeper-3.4.6.tar.gz
复制配置文件:
cp ~/Installs/zookeeper-3.4.6/conf/zoo_sample.cfg ~/Installs/zookeeper-3.4.6/conf/zoo.cfg
启动 ZooKeeper:
~/Installs/zookeeper-3.4.6/bin/zkServer.sh start
解压 Accumulo 文件并配置环境变量。
tar -xvzf ~/Downloads/accumulo-1.6.1-bin.tar.gz
复制配置文件:
cp ~/Installs/accumulo-1.6.1/conf/examples/512MB/standalone/* ~/Installs/accumulo-1.6.1/conf/
编辑 accumulo-env.sh:
nano ~/Installs/accumulo-1.6.1/conf/accumulo-env.sh
添加以下配置:
export ACCUMULO_MONITOR_BIND_ALL="true"
编辑 accumulo-site.xml:
nano ~/Installs/accumulo-1.6.1/conf/accumulo-site.xml
添加以下配置:
instance.secret PASS1234 instance.volumes hdfs://localhost:9000/accumulo trace.token.property.password mypassw
初始化 Accumulo:
~/Installs/accumulo-1.6.1/bin/accumulo init
选择 Instance 名称并设置密码:
~/Installs/accumulo-1.6.1/bin/start-all.sh
如果无法访问 Web 界面,检查 Hadoop 进程:
jps
确保 NameNode 运行正常:
cd ~/Installs/hadoop-2.6.0/~/Installs/hadoop-2.6.0/sbin/stop-dfs.shrm -rf hdfs_storagerm -rf /tmp/hadoop-*~/Installs/hadoop-2.6.0/bin/hdfs namenode -format~/Installs/hadoop-2.6.0/sbin/start-dfs.sh
通过以上步骤,我们成功安装并配置了一个基于 Ubuntu 14.04 的 Apache Accumulo NoSQL 数据库实例。Accumulo 利用 HDFS 存储数据并与 ZooKeeper 进行集群管理,支持大规模数据处理和高安全性访问。
转载地址:http://fydt.baihongyu.com/