配置HBase单机版

  • 配置JAVA_HOME

编辑conf/hbase-env.sh,指定包含/bin/java的路径为JAVA_HOME

export JAVA_HOME=/usr
  • 编辑HBase主配置文件

conf/hbase-site.xml

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/ubuntu/hbase/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/ubuntu/hbase/zookeeper</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      Controls whether HBase will check for stream capabilities (hflush/hsync).

      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.

      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
  </property>
</configuration>
  • 启动HBase

执行bin/start-hbase.sh

搭梯子

系统

Ubuntu 16.04 64bit

安装
apt-get install python-pip
pip install --upgrade pip
pip install shadowsocks
使用

配置文件  /etc/shadowsocks.json

{
    "server":"0.0.0.0",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

后台运行

ssserver -c /etc/shadowsocks.json -d start
ssserver -c /etc/shadowsocks.json -d stop

配置服务

/etc/init.d/shadowsocks

#!/bin/bash

start(){
    echo "Starting Shadowsocks..."
    /usr/local/bin/ssserver -c /etc/shadowsocks.json -d start
}

stop(){
    echo "Stoping Shadowsocks..."
    /usr/local/bin/ssserver -c /etc/shadowsocks.json -d stop
}
case $1 in
start):
start
;;
stop):
stop
;;
esac

exit 0

添加到service

update-rc.d shadowsocks defaults
service shadowsocks start
service shadowsocks stop

愉快的玩耍吧~~~

[LUA]做配置文件的一个简单例子

准备lua

新建一个config.lua文件,内容如下

--my config
MyConfigValue = 1234

准备C++

新建一个main.cpp文件,内容如下

#include<stdio.h>

extern "C"
{    
#include "lua.h"    
#include "lauxlib.h"    
#include "lualib.h"    
}    
   
void
ReadVariable(lua_State *L,int *myConfigValue)
{
    lua_getglobal(L,"MyConfigValue");
    
    if (!lua_isnumber(L,-1)) {
        luaL_error(L,"`MyConfigValue' should be a number\n");
    }
    
    *myConfigValue = (int)lua_tonumber(L,-1);
    printf("MyConfigValue is %d\n",*myConfigValue);
}
int main(int argc, char* argv[])    
{    
    if (argc != 2) {
        printf("param error!\n");    
        return 0;    
    }    
    
    char *filename = argv[1];    
    
    lua_State *L = luaL_newstate();    
    luaL_openlibs(L);  //新版本库添加的方法    
    if (luaL_loadfile(L,filename) || lua_pcall(L,0,0,0)) {
        luaL_error(L,"loadfile error! %s \n",lua_tostring(L,-1));    
    }    
    
    int myConfigValue=1;
    ReadVariable(L,&myConfigValue);
    return 0;  
}  

编译执行吧

$g++ main.cpp -llua -ldl
$./a.out config.lua

[LUA] Hello World!

Lua官方网站

http://www.lua.org/

环境配置

从lua的官方网站(http://www.lua.org/download.html)下载最新的lua代码,在本地编译

$make linux test
$sudo make install

新建一个hello.lua文件,内容如下

print("Hello World")

看看你的第一个lua程序吧

$lua hello.lua