存档

2011年1月 的存档

sftp get “Connection closed”

2011年1月30日 1 条评论
Some users experience “Connection closed” messages when attempting to use sftp, scp, svn+ssh or other ssh tunneled services if their profile contains errors.
use ssh+key can log to the server, but scp and sftp just return a “Connection closed”
$sftp -v 2hei.net
Connecting to 2hei.net…
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 2hei.net [192.168.1.100] port 22.
debug1: Connection established.
debug1: identity file /home/2hei/.ssh/id_rsa type 1
debug1: identity file /home/2hei/.ssh/id_dsa type -1
debug1: loaded 2 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host ‘2hei.net’ is known and matches the RSA host key.
debug1: Found key in /home/2hei/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Unknown code krb5 195
debug1: Unspecified GSS failure.  Minor code may provide more information
Unknown code krb5 195
debug1: Unspecified GSS failure.  Minor code may provide more information
Unknown code krb5 195
debug1: Next authentication method: publickey
debug1: Offering public key: /home/2hei/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 9.2 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status -1
Connection closed
this caused by .bashrc or .bash_profile, we can change our bash configs:
$cat .bashrc 
# .bash_profile
# Get the aliases and functions
#if [ -f ~/.bashrc ]; then
#        . ~/.bashrc
#fi
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
分类: OpenSource 标签:

compile pyhton2.7 with zlib

2011年1月14日 评论已被关闭
ensure you have installed zlib on your OS.
[2hei.net]# rpm -qa|grep zlib
zlib-1.2.3-3
zlib-devel-1.2.3-3
use source code to compile python2.7:
./configure –enable-shared && make && make install
If you still have this issue:
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file
solved:
vim /etc/ld.so.conf.d/python2.7.conf
/usr/local/lib
ldconfig
test:
[2hei.net]# python
Python 2.7.1 (r271:86832, Jan 14 2011, 01:34:20) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> imort
KeyboardInterrupt
>>> import sys
>>> sys.modules
{‘copy_reg’: <module ‘copy_reg’ from ‘/usr/local/lib/python2.7/copy_reg.pyc’>, ‘sre_compile’: <module ‘sre_compile’ from ‘/usr/local/lib/python2.7/sre_compile.pyc’>, ‘_sre’: <module ‘_sre’ (built-in)>, ‘encodings’: <module ‘encodings’ from ‘/usr/local/lib/python2.7/encodings/__init__.pyc’>, ‘site’: <module ‘site’ from ‘/usr/local/lib/python2.7/site.pyc’>, ‘__builtin__’: <module ‘__builtin__’ (built-in)>, ‘sysconfig’: <module ‘sysconfig’ from ‘/usr/local/lib/python2.7/sysconfig.pyc’>, ‘__main__’: <module ‘__main__’ (built-in)>, ‘encodings.encodings’: None, ‘abc’: <module ‘abc’ from ‘/usr/local/lib/python2.7/abc.pyc’>, ‘posixpath’: <module ‘posixpath’ from ‘/usr/local/lib/python2.7/posixpath.pyc’>, ‘_weakrefset’: <module ‘_weakrefset’ from ‘/usr/local/lib/python2.7/_weakrefset.pyc’>, ‘errno’: <module ‘errno’ (built-in)>, ‘encodings.codecs’: None, ‘sre_constants’: <module ‘sre_constants’ from ‘/usr/local/lib/python2.7/sre_constants.pyc’>, ‘re’: <module ‘re’ from ‘/usr/local/lib/python2.7/re.pyc’>, ‘_abcoll’: <module ‘_abcoll’ from ‘/usr/local/lib/python2.7/_abcoll.pyc’>, ‘types’: <module ‘types’ from ‘/usr/local/lib/python2.7/types.pyc’>, ‘_codecs’: <module ‘_codecs’ (built-in)>, ‘_warnings’: <module ‘_warnings’ (built-in)>, ‘genericpath’: <module ‘genericpath’ from ‘/usr/local/lib/python2.7/genericpath.pyc’>, ‘stat’: <module ‘stat’ from ‘/usr/local/lib/python2.7/stat.pyc’>, ‘zipimport’: <module ‘zipimport’ (built-in)>, ‘encodings.__builtin__’: None, ‘warnings’: <module ‘warnings’ from ‘/usr/local/lib/python2.7/warnings.pyc’>, ‘UserDict’: <module ‘UserDict’ from ‘/usr/local/lib/python2.7/UserDict.pyc’>, ‘encodings.utf_8’: <module ‘encodings.utf_8’ from ‘/usr/local/lib/python2.7/encodings/utf_8.pyc’>, ‘sys’: <module ‘sys’ (built-in)>, ‘codecs’: <module ‘codecs’ from ‘/usr/local/lib/python2.7/codecs.pyc’>, ‘os.path’: <module ‘posixpath’ from ‘/usr/local/lib/python2.7/posixpath.pyc’>, ‘signal’: <module ‘signal’ (built-in)>, ‘linecache’: <module ‘linecache’ from ‘/usr/local/lib/python2.7/linecache.pyc’>, ‘posix’: <module ‘posix’ (built-in)>, ‘encodings.aliases’: <module ‘encodings.aliases’ from ‘/usr/local/lib/python2.7/encodings/aliases.pyc’>, ‘exceptions’: <module ‘exceptions’ (built-in)>, ‘sre_parse’: <module ‘sre_parse’ from ‘/usr/local/lib/python2.7/sre_parse.pyc’>, ‘os’: <module ‘os’ from ‘/usr/local/lib/python2.7/os.pyc’>, ‘_weakref’: <module ‘_weakref’ (built-in)>}
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
分类: python 标签: ,

eventfd() failed when start nginx

2011年1月7日 评论已被关闭

yum install nginx
service nginx start

error.log:
2011/01/07 05:39:49 [emerg] 7180#0: eventfd() failed (38: Function not implemented)
2011/01/07 05:39:49 [alert] 7179#0: worker process 7180 exited with fatal code 2 and can not be respawn
2011/01/07 05:43:01 [emerg] 7296#0: eventfd() failed (38: Function not implemented)
2011/01/07 05:43:01 [alert] 7295#0: worker process 7296 exited with fatal code 2 and can not be respawn

[root@2hei.net /etc/nginx]# /usr/sbin/nginx -V
nginx version: nginx/0.8.53
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
TLS SNI support disabled
configure arguments: –user=nginx –group=nginx –prefix=/usr/share/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi –http-scgi-temp-path=/var/lib/nginx/tmp/scgi –pid-path=/var/run/nginx.pid –lock-path=/var/lock/subsys/nginx –with-http_ssl_module –with-http_realip_module –with-http_addition_module –with-http_xslt_module –with-http_image_filter_module –with-http_geoip_module –with-http_sub_module –with-http_dav_module –with-http_flv_module –with-http_gzip_static_module –with-http_random_index_module –with-http_secure_link_module –with-http_degradation_module –with-http_stub_status_module –with-http_perl_module –with-mail –with-file-aio –with-mail_ssl_module –with-ipv6 –with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic’ –with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic’

we can see –with-file-aio is been compiled at yum.

[root@2hei.net /etc/nginx]# yum list | grep aio
libaio.i386                              0.3.106-3.2            installed       
libaio.x86_64                            0.3.106-3.2            installed       
libsane-hpaio.x86_64                     1.6.7-4.1.el5.4        installed       
libaio-devel.x86_64                      0.3.106-3.2            base            
libaio-devel.i386                        0.3.106-3.2            base   

yum install libaio-devel
restart nginx still has such error.

Got a new stable version of nginx
nginx version: nginx/0.8.54
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
TLS SNI support disabled
configure arguments: –user=nginx –group=nginx –prefix=/usr/share/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –pid-path=/var/run/nginx.pid –lock-path=/var/lock/subsys/nginx –with-http_ssl_module –with-http_realip_module –with-http_addition_module –with-http_sub_module –with-http_dav_module –with-http_flv_module –with-http_gzip_static_module –with-http_stub_status_module –with-http_perl_module –with-mail –with-mail_ssl_module –with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic’ –add-module=/builddir/build/BUILD/nginx-0.8.54/nginx-upstream-fair
download link: nginx-stable-0.8.54-1.el5.x86_64.rpm
useful link:
http://forum.nginx.org/read.php?2,23577,153119#msg-153119
http://forum.nginx.org/read.php?2,150853,150853

分类: nginx, OpenSource 标签:

postgresql learning notes

2011年1月4日 评论已被关闭

1.Host Access file:
/var/lib/pgsql/data/pg_hba.conf
host    all         all         172.16.1.0/24        md5

2.logon postgresql
su – postgres
$psql
or $psql -U postgres -h 127.0.0.1
postgres=# create user “2hei” with password ‘pwd’ nocreatedb;
postgres=# create database “test_db” with owner=”2hei”;
\lu
\q

3.test link
linux:
psql -U 2hei -h 172.16.1.100
windows
D:/soft/postgresql9/bin/psql.exe -h 172.16.1.100 -U 2hei -d test_db -p 5432 -c “\l”

4.set sys env (linux/windows)
PGPASSWORD
hostname:port:database:username:password

5copy without pwd:
D:\soft\postgresql9\bin\psql.exe -h localhost -U 2hei -d test_db -p 5432 -c “COPY test_tb(name,desc,comm1,comm2) FROM  ‘D:/upload.txt’ WITH DELIMITER ‘,’ NULL AS ” csv;”

cat upload.txt
1,2,3,4
2,3,4,5
————

分类: database 标签: