ivaneeo's blog

自由的力量,自由的生活。

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks

#

在debian6中,加入开机启动脚本的方法与debian5不同了,直接做符号链接到runlevel已经不起作用了,提示缺少LSB信息,并且用insserv来替代update-rc.d:

root@14:/etc/rc2.d# update-rc.d -n  php_fastcgi.sh  defaults           
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'K02php_fastcgi' missing LSB tags and overrides
insserv: warning: script 'K01php_fastcgi.sh' missing LSB tags and overrides
insserv: warning: script 'php_fastcgi.sh' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (empty) of script `php_fastcgi.sh' overwrites defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0) of script `php_fastcgi.sh' overwrites defaults (0 1 6).
insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop

# insserv /etc/init.d/php_fastcgi.sh
insserv: warning: script 'K02php_fastcgi' missing LSB tags and overrides
insserv: warning: script 'php_fastcgi.sh' missing LSB tags and overrides

 

debian6中将脚本加入到开机启动的方法:

在脚本中加入LSB描述信息。
root@14:~# more  /etc/init.d/php_fastcgi.sh   
#!/bin/sh
### BEGIN INIT INFO
# Provides:          php_fastcgi.sh
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the php_fastcgi daemon
# Description:       starts php_fastcgi using start-stop-daemon
### END INIT INFO

安装启动脚本到system init script。
root@14:~# insserv -v -d /etc/init.d/php_fastcgi.sh

重启机器试试吧。

posted @ 2013-09-29 14:45 ivaneeo 阅读(4794) | 评论 (0)编辑 收藏

linux 广播 255.255.255.255

               sendto error: Network is unreachable

              全网广播


场景:

    今天调试linux 网络编程的广播,当向255.255.255.255 的某个端口发送广播包的时候,sendto 返回 -1,错误原因是:

sendto error: Network is unreachable。


2. 指令的解决方法:

oute add -net 255.255.255.255 netmask 255.255.255.255 dev eth0 metric 1

或者

route add -host 255.255.255.255 dev eth0



http://blog.csdn.net/qiaoliang328/article/details/8881474
posted @ 2013-09-10 19:40 ivaneeo 阅读(622) | 评论 (0)编辑 收藏

devcon install c:\windows\inf\netloop.inf *MSLOOP
posted @ 2013-08-17 11:20 ivaneeo 阅读(502) | 评论 (0)编辑 收藏

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam" /v @ /t REG_SZ /d "%Name%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Eventlog" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t REG_SZ /d "%Name%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /t REG_SZ /d "%Name%" /f
posted @ 2013-08-14 22:38 ivaneeo 阅读(287) | 评论 (0)编辑 收藏

Impala是由Cloudera开发的高性能实时计算工具,相比Hive性能提升了几十、甚至近百倍,基本思想是将计算分发到每个 Datanode所在的节点,依靠内存实现数据的缓存进行快速计算,类似的系统还有Berkeley的Shark。从实际测试来看,Impala效率确实 不错,由于Impala大量使用C++实现,不使用CDH的Image而自己编译安装要费不少功夫,这里记录一下安装配置过程和碰到的一些问题。我在测试 时候使用的是CentOS6.2。
一些基本的安装步骤在这里,但我在安装的时候碰到一些问题,这里再详细说明一下过程。

1.安装所需的依赖lib,这一步没有什么不同

sudo yum install boost-test boost-program-options libevent-devel automake libtool flex bison gcc-c++ openssl-devel make cmake doxygen.x86_64 glib-devel boost-devel python-devel bzip2-devel svn libevent-devel cyrus-sasl-devel wget git unzip

2.安装LLVM,按照流程做即可,注意要在多台机器上编译安装Impala的话,只用在一台机器上执行下面蓝色的部分,再把llvm分发到多台机器上执行后面红色部分的指令就可以了,没必要每个机器都通过svn下载一遍源代码,很费时。

wget http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
tar xvzf llvm-3.2.src.tar.gz
cd llvm-3.2.src/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final/ clang
cd ../projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_32/final/ compiler-rt
cd ..
./configure –with-pic
make -j4 REQUIRES_RTTI=1
sudo make install

3.安装Maven,这个没什么好说的,按照步骤,设置一下环境变量即可,Maven是为了后面build impala源代码用的。

wget http://www.fightrice.com/mirrors/apache/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
tar xvf apache-maven-3.0.4.tar.gz && sudo mv apache-maven-3.0.4 /usr/local

修改~/.bashrc,增加maven环境变量

export M2_HOME=/usr/local/apache-maven-3.0.4
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

更新环境变量,查看mvn版本是否正确

source ~/.bashrc
mvn -version

4.下载Impala源代码

git clone https://github.com/cloudera/impala.git

5.设置Impala环境变量,编译时需要

cd impala
./bin/impala-config.sh

6.下载impala依赖的第三方package

cd thirdparty
./download_thirdparty.sh

注意这里其中一个包cyrus-sasl-2.1.23可能下载失败,可以自行搜索(CSDN里面就有)下载下来然后解压缩到thirdparty 文件夹,最好是在执行完download_thirdparty.sh之后做这一步,因为download_thirdparty.sh会把所有目录下下 载下来的tar.gz给删除掉。

7.理论上现在可以开始build impala了,但是实际build过程中可能会出现问题,我碰到的问题和 Boost相关的(具体错误不记得了),最后发现是由于boost版本太低导致的,CentOS 6.2系统默认yum源中的boost和boost-devel版本是1.41,但是impala编译需要1.44以上的版本,因此需要做的是自己重新编 译boost,我用的是boost 1.46版本。

#删除已安装的boost和boost-devel
yum remove boost
yum remove boost-devel
#下载boost
#可以去(http://www.boost.org/users/history/)下载boost
#下载后解压缩
tar xvzf boost_1_46_0.tar.gz
mv boost_1_46_0 /usr/local/
cd /usr/include
./bootstrap.sh
./bjam
#执行后若打印以下内容,则表示安装成功
# The Boost C++ Libraries were successfully built!
# The following directory should be added to compiler include paths:
# /usr/local/boost_1_46_0
# The following directory should be added to linker library paths:
# /usr/local/boost_1_46_0/stage/lib
#现在还需要设置Boost环境变量和Impala环境变量

export BOOST_ROOT=’/usr/local/boost_1_46_0′
export IMPALA_HOME=’/home/extend/impala’

#注意一下,这里虽然安装了boost,但是我在实际使用的时候,编译还是会报错的,报的错误是找不到这个包:#libboost_filesystem-mt.so,这个包是由boost-devel提供的,所以我的做法是把boost-devel给重新装上
#我没有试过如果之前不删除boost-devel会不会有问题,能确定的是按这里写的流程做是没问题的

yum install boost-devel

8.现在终于可以编译impala了

cd $IMPALA_HOME
./build_public.sh -build_thirdparty
#编译首先会编译C++部分,然后再用mvn编译java部分,整个过程比较慢,我在虚拟机上大概需要1-2个小时。
#Impala编译完后的东西在be/build/debug里面

9.启动impala_shell需要用到的python包

#第一次执行impalad_shell可能会报错,这里需要安装python的两个包:thrift和prettytable,使用easy_install即可
easy_install prettytable
easy_install thrift

10.如果你以为到这里就万事大吉就太天真了,在配置、启动、使用Impala的时候还会有很多奇葩的问题;

问题1:Hive和Hadoop使用的版本
CDH对版本的依赖要求比较高,为了保证Impala正常运行,强烈建议使用Impala里面thirdparty目录中自带的Hadoop(native lib已经编译好的)和Hive版本。
Hadoop的配置文件在$HADOOP_HOME/etc/hadoop中,要注意的是需要启用native lib

#修改hadoop的core-site.xml,除了这个选项之外,其他配置和问题2中的core-site.xml一致
<property>
  <name>hadoop.native.lib</name>
  <value>true</value>
  <description>Should native hadoop libraries, if present, be used.</description>
</property>

问题2:Impala的配置文件位置
Impala默认使用的配置文件路径是在bin/set-classpath.sh中配置的,建议把CLASSPATH部分改成

CLASSPATH=\
$IMPALA_HOME/conf:\
$IMPALA_HOME/fe/target/classes:\
$IMPALA_HOME/fe/target/dependency:\
$IMPALA_HOME/fe/target/test-classes:\
${HIVE_HOME}/lib/datanucleus-core-2.0.3.jar:\
${HIVE_HOME}/lib/datanucleus-enhancer-2.0.3.jar:\
${HIVE_HOME}/lib/datanucleus-rdbms-2.0.3.jar:\
${HIVE_HOME}/lib/datanucleus-connectionpool-2.0.3.jar:

即要求Impala使用其目录下的Conf文件夹作为配置文件,然后创建一下Conf目录,把3样东西拷贝进来:core-site.xml、hdfs-site.xml、hive-site.xml。
core-site.xml的配置,下面几个选项是必须要配置的,

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://10.200.4.11:9000</value>
</property>
<property>
<name>dfs.client.read.shortcircuit</name>
<value>true</value>
</property>
<property>
<name>dfs.client.use.legacy.blockreader.local</name>
<value>false</value>
</property>
<property>
<name>dfs.client.read.shortcircuit.skip.checksum</name>
<value>false</value>
</property>
</configuration>

hdfs-site.xml的配置

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>dfs.block.local-path-access.user</name>
<value>${your user}</value>
</property>
<property>
<name>dfs.datanode.hdfs-blocks-metadata.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>${yourdatadir}</value>
</property>
<property>
   <name>dfs.client.use.legacy.blockreader.local</name>
   <value>false</value>
</property>
<property>
   <name>dfs.datanode.data.dir.perm</name>
   <value>750</value>
</property>
<property>
    <name>dfs.client.file-block-storage-locations.timeout</name>
    <value>5000</value>
</property>
<property>
    <name>dfs.domain.socket.path</name>
    <value>/home/extend/cdhhadoop/dn.8075</value>
</property>
</configuration>

最后是hive-site.xml,这个比较简单,指定使用DBMS为元数据存储即可(impala必须和hive共享元数据,因为impala无 法create table);Hive-site.xml使用mysql作为metastore的说明在很多地方都可以查到,配置如下:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://10.28.0.190:3306/impala?createDatabaseIfNotExist=true</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
  <description>Driver class name for a JDBC metastore</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>root</value>
  <description>username to use against metastore database</description>
</property>
<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>root</value>
  <description>password to use against metastore database</description>
</property>
</configuration>

记得把mysql-connector的jar包给拷贝到hive的lib里面去,同样也要拷贝给impala ( 拷贝至$IMPALA_HOME/fe/target/dependency)

11.启动Impala。到此,Impala是可以正常启动的。这里说明一下,官方文档没有说很清楚Impala的Service之间是如何互相协调的,按照官方的步骤,最后通过如下方法来在一台机器上启动Impala Service:

#启动单机impala service
${IMPALA_HOME}/bin/start-impalad.sh -use_statestore=false
#启动impala shell
${IMPALA_HOME}/bin/impala-shell.sh

然后impala-shell就可以连接到localhost进行查询了;注意,这里只是单机查询,可以用来验证你的Impala是否正常work 了;如何启动一个Impala集群,跳到第12步。这里继续说一下可能遇到的问题,我遇到的一个比较奇葩的问题是show tables和count(1)没有问题,但是select * from table的时候impala在读取数据的时候就崩溃了(有时报错could not find method close from class org/apache/hadoop/fs/FSDataInputStream with signature ()V ),这里修改了两个地方解决这个问题:

a.修改impala的set-classpath.sh并移除$IMPALA_HOME/fe/target/dependency目录中除了hadoop-auth-2.0.0-*.jar之外所有hadoop-*开头的jar包。

#把impala dependency中和hadoop相关的包给弄出来,只保留auth
mv $IMPALA_HOME/fe/target/dependency/hadoo* $IMPALA_HOME
mv $IMPALA_HOME/hadoop-auth*.jar mv $IMPALA_HOME/fe/target/dependency
#修改bin/set-classpath.sh,将$HADOOP_HOME中的lib给加入,在set-classpath.sh最后一行export CLASSPATH之前#添加
for jar in `ls $HADOOP_HOME/share/hadoop/common/*.jar`; do
CLASSPATH=${CLASSPATH}:$jar
done
for jar in `ls $HADOOP_HOME/share/hadoop/yarn/*.jar`; do
CLASSPATH=${CLASSPATH}:$jar
done
for jar in `ls $HADOOP_HOME/share/hadoop/hdfs/*.jar`; do
CLASSPATH=${CLASSPATH}:$jar
done
for jar in `ls $HADOOP_HOME/share/hadoop/mapreduce/*.jar`; do
CLASSPATH=${CLASSPATH}:$jar
done
for jar in `ls $HADOOP_HOME/share/hadoop/tools/lib/*.jar`; do
CLASSPATH=${CLASSPATH}:$jar
done

b.注意到Impala对待table的时候只能够使用hive的默认列分隔符,如果在hive里面create table的时候使用了自定义的分隔符,Impala servive就会在读数据的时候莫名其妙的崩溃。

12.启动Impala 集群
Impala实际上由两部分组成,一个是StateStore,用来协调各个机器计算,相当于Master,然后就是Impalad,相当于Slave,启动方法如下:

#启动statestore
#方法1,直接利用impala/bin下面的这个python脚本
#这个脚本会启动一个StateStore,同时启动-s个数量的Impala Service在本机
$IMPALA_HOME/bin/start-impala-cluster.py -s 1 –log_dir /home/extend/impala/impalaLogs
#方法2,手动启动StateStore
$IMPALA_HOME/be/build/debug/statestore/statestored -state_store_port=24000

#启动impala service
#在每个编译安装了impala的节点上执行命令
#参数-state_store_host指定启动了stateStore的机器名
#-nn即namenode,指定hadoop的namenode
#-nn_port是namenode的HDFS入口端口号
$IMPALA_HOME/bin/start-impalad.sh -state_store_host=m11 -nn=m11 -nn_port=9000

正常启动之后,访问http://${stateStore_Server}:25010/ 可以看到StateStore的状态,其中的subscribers页面可以看到已经连接上的impala service node;

13.使用Impala客户端
这一步最简单,随便找一个机器启动

$IMPALA_HOME/bin/impala-shell.sh
#启动之后可以随便连接一个impala service
connect m12
#连接上之后就可以执行show tables之类的操作了
#需要注意的是,如果hive创建表或更新了表结构,impala的节点是不知道的
#必须通过客户端连接各个impala service并执行refresh来刷新metadata
#或者重启所有impala service
posted @ 2013-06-29 17:12 ivaneeo 阅读(1703) | 评论 (1)编辑 收藏

nohup ./bin/startServer.sh -r hotrod -l 172.20.21.1 -c ./etc/config-samples/distributed-udp.xml -p 11222 &
posted @ 2013-06-07 19:32 ivaneeo 阅读(270) | 评论 (0)编辑 收藏

http://www.ibm.com/developerworks/cn/aix/library/au-kerbauthent/
posted @ 2013-05-20 12:15 ivaneeo 阅读(264) | 评论 (0)编辑 收藏

Kerberos Server Configuration

These notes are for MIT Kerberos 1.3 or higher.

  • /etc/krb5.conf
  • The /etc/krb5.conf configuration file should include rc4-hmac support under the [libdefaults] section. Windows XP uses rc4-hmac. However, do not include rc4-hmac in the default* encryption types, as older Unix clients may not support rc4-hmac.

    [libdefaults]
    default_realm = EXAMPLE.ORG
    default_etypes = des3-hmac-sha1 des-cbc-crc
    default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
    default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
    permitted_enctypes = des3-hmac-sha1 des-cbc-crc rc4-hmac
    dns_lookup_realm = false
    dns_lookup_kdc = true

  • kdc.conf
  • The kdc.conf configuration file on the Kerberos servers must support rc4-hmac as an encryption type.

    [realms]
    EXAMPLE.ORG = {
    database_name = /var/kerberos/krb5kdc/principal
    key_stash_file = /var/kerberos/krb5kdc/.k5.EXAMPLE.ORG
    supported_enctypes = des3-hmac-sha1:normal des-cbc-crc:normal ?
    rc4-hmac:normal
    }

Windows Client Setup

  • Kerberos Configuration
  • Use the ksetup.exe command to add the site Kerberos servers.

    $ ksetup.exe /addkdc EXAMPLE.ORG kerberos-1.example.org
    $ ksetup.exe /addkdc EXAMPLE.ORG kerberos-2.example.org
    $ ksetup.exe /addkdc EXAMPLE.ORG kerberos.example.org
    $ ksetup.exe /addkpasswd EXAMPLE.ORG kerberos.example.org
    $ ksetup.exe /setrealm EXAMPLE.ORG

  • Host principals
  • Create host principals on each Windows client, then use the same password to create an equivalent principal in the MIT Kerberos database. If using an installation system such as Unattended, use a script to generate the random password and setup the host principal.

    #!/usr/bin/perl

    my $domain = 'example.org';

    my $password = '';
    my @chars = grep { /[[:print:]]/ and /\S/ } map { chr } 1..128;
    $password .= $chars[rand @chars] for 1..(int (rand 7)) + 8;

    system qw{ksetup.exe /setcomputerpassword}, $password;

    print "Principal: host/", lc( $ENV{COMPUTERNAME} ), ".$domain\n";
    print "Password: $password\n";

    Then, use kdamin to add an equivalent principal to the Kerberos database, using the same password as above. Use the -e rc4-hmac:normal encryption option if adding a principal for a Windows XP system.

    kadmin: ank -e rc4-hmac:normal host/client.example.org

  • User Mapping
  • User mapping translates local accounts to the Kerberos domain. See module:users for user account management under CFEngine.

    $ ksetup.exe /mapuser * *

Samba

Windows clients can authenticate to Samba using Kerberos. Use Samba version 3.0.14a or higher on the server, and enable Kerberos support in the smb.conf configuration file.

[global]
use kerberos keytab = yes
realm = EXAMPLE.ORG
security = ads

Multiple host and cifs principals must be created for each Samba server, as principals are case sensitive, and Windows systems may randomly start using Server.example.org or SERVER.EXAMPLE.ORG when connecting. Extract these principals to the /etc/krb5.keytab file on each Samba server.

kadmin: ank -randkey host/server.example.org
kadmin: ank -randkey host/Server.example.org
kadmin: ank -randkey host/SERVER.EXAMPLE.ORG
kadmin: ank -randkey cifs/server.example.org
kadmin: ank -randkey cifs/Server.example.org
kadmin: ank -randkey cifs/SERVER.EXAMPLE.ORG
kadmin: ktadd -k /etc/krb5.keytab host/server.example.org
kadmin: ktadd -k /etc/krb5.keytab host/Server.example.org
kadmin: ktadd -k /etc/krb5.keytab host/SERVER.EXAMPLE.ORG
kadmin: ktadd -k /etc/krb5.keytab cifs/server.example.org
kadmin: ktadd -k /etc/krb5.keytab cifs/Server.example.org
kadmin: ktadd -k /etc/krb5.keytab cifs/SERVER.EXAMPLE.ORG

posted @ 2013-05-18 15:04 ivaneeo 阅读(339) | 评论 (0)编辑 收藏


1.首先安装后,有一个180天的试用期。
2.在180天试用期即将结束时,使用下面的评估序列号激活Svr 2008 R2 可以重新恢复180天试用期
Windows Server 2008 R2 Web: KBV3Q-DJ8W7-VPB64-V88KG-82C49
Windows Server 2008 R2 Standard: 4GGC4-9947F-FWFP3-78P6F-J9HDR
Windows Server 2008 R2 Enterprise: 7PJBC-63K3J-62TTK-XF46D-W3WMD
Windows Server 2008 R2 Datacenter: QX7TD-2CMJR-D7WWY-KVCYC-6D2YT
3.在180天试用期即将结束时,用“Rearm”后,重新输入上面的序列号,重启电脑,剩余时间又恢复到180天。微软官方文档中声明该命令只能重复使用5次。
4.上面的方法5次后,此后将无法再次使用。就要进行下一步,修改注册表中的一处键值(SkipRearm),以后就可以再次使用“Rearm”的命令,这个键值总共可以修改8次。
5.因此……。
posted @ 2013-05-08 17:47 ivaneeo 阅读(305) | 评论 (0)编辑 收藏

        char Str[20];
        int ret;
        ret = sprintf(Str, "%llu",ifconfig.flags);
posted @ 2013-04-22 21:29 ivaneeo 阅读(293) | 评论 (0)编辑 收藏

仅列出标题
共67页: First 上一页 7 8 9 10 11 12 13 14 15 下一页 Last