English Sentence Loading...
英语句子加载中...
预览模式: 普通 | 列表

rsync 常见错误及解决方法(中文版)

编译错误
options.c:24:18: popt.h: No such file or directory
make: *** [options.o] Error 1
解决方法
丢失popt.h,添加编译选项 --with-included-popt

-------------------------------------------------------------------------------------------------------------

连接错误
@ERROR: auth failed on module rsyncd_module
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
解决方法
检查日志文件/var/log/rsyncd.log,以获取更多帮助信息

-------------------------------------------------------------------------------------------------------------

配置文件错误
secrets file must not be other-accessible (see strict modes option)
continuing without secrets file
解决方法
初始化设置strict modes = false 或修改密码文件权限 chmod 600 /path/to/secrets

-------------------------------------------------------------------------------------------------------------

配置文件错误
Ignoring badly formed line in configuration file: xxx
解决方法
检查 /etc/rsyncd.conf 文件中xxx所在行,它应该包含变量、等号(=)、和值。

-------------------------------------------------------------------------------------------------------------

配置文件错误
rsync: chroot /path/to/files failed: Operation not permitted (1)
解决方法
如果你没有超级用户权限,请将设置选项 use chroot = false 。
如果为true,那么在rsync在传输文件以前首先chroot到path参数指定的目录下。这样做的原因是实现额外的安全防护,但是缺点是需要root权限,并且不能备份指向外部的符号连接指向的目录文件。

-------------------------------------------------------------------------------------------------------------

客户端错误
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(604) [receiver=2.6.9]

rsync: getaddrinfo: mydomain.com xxx: no address associated with hostname.
rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]

rsync: failed to connect to mydomain.com: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
解决方法
rsync服务器没有在指定的端口上运行。检查rsync服务器端口是否指定,并检查其是否运行 ps -aux。

-------------------------------------------------------------------------------------------------------------

客户端错误
@ERROR: auth failed on module rsyncd_module
rsync error: error starting client-server protocol (code 5) at /home/lapo/packaging/tmp/rsync-2.6.6/main.c(1171)
解决方法
rsync调用时用户名必须在站点名前面,例如: rsync -auvzbP /cygwin/local/path/ user@remotehost.com::desired_module --port=8730

-------------------------------------------------------------------------------------------------------------

客户端错误
14 [main] (2164) C:\Program Files\cwRsync\bin\ssh.exe: *** fatal error - C:\Program Files\cwRsync\bin\ssh.exe: *** system shared memory version mismatch detected - 0x2D1E009C/0x75BE009C.
解决方法
请确保你正在rsync同一目录下运行SSH。此问题可能是由于你使用了不兼容的Cygwin DLL版本,在windows下查找cygwin1.dll并删除所有的旧版本,最新的版本应该在x:\cygwin\bin(x为你安装cygwin的分区),如果找不到建议重启再试。

-------------------------------------------------------------------------------------------------------------

客户端错误
@ERROR: auth failed on module rsyncd_module
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
解决方法
配置文件中(通常是/etc/rsyncd.conf)“auth users”选项和“secrets file” 文件中定义给module的用户列表不匹配。

-------------------------------------------------------------------------------------------------------------

客户端错误
/bin/sh: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(453) [receiver=2.6.9]
解决方法
检查rsync是否在你当前登录的ssh会话的环境变量中。
你可以通过命令ssh -2 -v mylogin@mydomain.com 登录到服务器,然后使用 env|grep -i path 来检查。
你可以将/etc/rsyncd/wrapper.sh添加到/.ssh/authorized_keys文件的第一行,并将它设置为可执行权限。

-------------------------------------------------------------------------------------------------------------

更从配置说明与参数介绍请参阅:Ubuntu rsync同步文件实例

标签: rsync linux

rsync 常见错误及解决办法

查看中文版

Make error
options.c:24:18: popt.h: No such file or directory
make: *** [options.o] Error 1
Solution
Missing popt.h Change configure to include --with-included-popt

-------------------------------------------------------------------------------------------------------------

Connect Error
@ERROR: auth failed on module rsyncd_module
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
Solution
Check /var/log/rsyncd.log file for further details

-------------------------------------------------------------------------------------------------------------

rsyncd.log Error
secrets file must not be other-accessible (see strict modes option)
continuing without secrets file
Solution
EITHER set option strict modes = false in initial section of configuration file OR chmod 600 /path/to/secrets

-------------------------------------------------------------------------------------------------------------

rsyncd.log Error
Ignoring badly formed line in configuration file: xxx
Solution
Check syntax of line given (xxx) in /etc/rsyncd.conf. It should consist of an option, an equals sign (=) and a value.

-------------------------------------------------------------------------------------------------------------

rsyncd.log Error
rsync: chroot /path/to/files failed: Operation not permitted (1)
Solution
Set Module Option use chroot = false if you do not have super user access. When “use chroot” is false, symlinks may only be relative paths pointing to other files within the root path, for security reasons and leading slashes are removed from most absolute paths

-------------------------------------------------------------------------------------------------------------

rsync Client error
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(604) [receiver=2.6.9]
OR
rsync: getaddrinfo: mydomain.com xxx: no address associated with hostname.
rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
OR
rsync: failed to connect to mydomain.com: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
Solution
No rsync server runnning on specified port of server. Check that correct port was specified. Also, check that the rsync server is running by typing ps -auxww.

-------------------------------------------------------------------------------------------------------------

rsync Client error
@ERROR: auth failed on module rsyncd_module
rsync error: error starting client-server protocol (code 5) at /home/lapo/packaging/tmp/rsync-2.6.6/main.c(1171)
Solution
rsync needs to be called with the username before the site name. For example rsync -auvzbP /cygwin/local/path/ user@remotehost.com::desired_module --port=8730

-------------------------------------------------------------------------------------------------------------

rsync Client error
14 [main] (2164) C:\Program Files\cwRsync\bin\ssh.exe: *** fatal error - C:\Program Files\cwRsync\bin\ssh.exe: *** system shared memory version mismatch detected - 0x2D1E009C/0x75BE009C.
Solution
Make sure that you are running SSH from the same directory as rsync. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where ‘x’ is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL.

-------------------------------------------------------------------------------------------------------------

rsync Client error
@ERROR: auth failed on module rsyncd_module
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
Solution
Mismatch between “auth users” line for module rsyncd_module in configuration file (Normally /etc/rsyncd.conf) and users listed in “secrets file” specified in module’s definition.

-------------------------------------------------------------------------------------------------------------

rsync Client error
/bin/sh: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(453) [receiver=2.6.9]
Solution
Check that rsync is in the path of your SSH session as the environment may well be different for SSH to that for a normal login. To verify this, try executing the command ssh -2 -v mylogin@mydomain.com “env|grep -i path”. You can modify /.ssh/authorized_keys to include the line command=”/etc/rsyncd/wrapper.sh” as the first line. You will need to create the wrapper and make it executable.

标签: linux rsync

CentOS 安装 Sphinx 全文检索

1. 下载Sphinx最新版 http://www.sphinxsearch.com/downloads.html

2. 安装
# tar -zxvf sphinx-0.9.9.tar.gz
# cd sphinx-0.9.9/
# ./configure --prefix=/usr/local/sphinx --with-mysql-includes=/usr/local/mysql/include/mysql/ --with-mysql-libs=/usr/local/mysql/lib/mysql --with-iconv
# make && make install


3. 配置
# cd /usr/local/sphinx/etc
# cp sphinx-min.conf.dist joomla.conf
# vi joomla.conf


#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source joomla_src
{
        type                   = mysql

        sql_host               = localhost
        sql_user               = root
        sql_pass               = 123456
        sql_db                 = joomla
        sql_port               = 3306  # optional, default is 3306

        sql_query              = SELECT * FROM jos_content

        sql_attr_uint          = id
        sql_attr_timestamp     = created

        sql_query_info         = SELECT * FROM jos_content WHERE id=$id
}


index joomla_index
{
        source                 = joomla_src
        path                   = /usr/local/sphinx/var/data/joomla_index
        docinfo                = extern
        charset_type           = utf-8
}


indexer
{
        mem_limit              = 32M
}


searchd
{
        port                   = 9312
        log                    = /usr/local/sphinx/var/log/searchd.log
        query_log              = /usr/local/sphinx/var/log/query.log
        read_timeout           = 5
        max_children           = 30
        pid_file               = /usr/local/sphinx/var/log/searchd.pid
        max_matches            = 1000
        seamless_rotate        = 1
        preopen_indexes        = 0
        unlink_old             = 1
}

保存退出

4. 建立索引
# /usr/local/sphinx/bin/indexer  --config joomla.conf  --all joomla_index

5. 启动sphinx后台服务
# /usr/local/sphinx/bin/searchd -c /usr/local/sphinx/etc/joomla.conf  -i joomla_index &

6. 测试
#/usr/local/php/bin/php-cgi test.php -h localhost -p 9312 -i joomla_index -ph title
X-Powered-By: PHP/5.2.10
Content-type: text/html

Query 'title ' retrieved 16 of 16 matches in 0.001 sec.
Query stats:
    'title' found 61 times in 16 documents

Matches:
1. doc_id=44, weight=2, created=1970-01-01 07:33:27
2. doc_id=1, weight=1, created=1970-01-01 07:33:28
3. doc_id=4, weight=1, created=1970-01-01 07:33:28
4. doc_id=5, weight=1, created=1970-01-01 07:33:28
5. doc_id=10, weight=1, created=1970-01-01 07:33:28
6. doc_id=11, weight=1, created=1970-01-01 07:33:28
7. doc_id=20, weight=1, created=1970-01-01 07:33:28
8. doc_id=21, weight=1, created=1970-01-01 07:33:28
9. doc_id=24, weight=1, created=1970-01-01 07:33:28
10. doc_id=25, weight=1, created=1970-01-01 07:33:28
11. doc_id=26, weight=1, created=1970-01-01 07:33:28
12. doc_id=27, weight=1, created=1970-01-01 07:33:28
13. doc_id=28, weight=1, created=1970-01-01 07:33:28
14. doc_id=30, weight=1, created=1970-01-01 07:33:28
15. doc_id=38, weight=1, created=1970-01-01 07:33:28
16. doc_id=45, weight=1, created=1970-01-01 07:33:27

Ubuntu 安装 python-mysqldb

首先下载MySQLdb库,然后进行安装。

./setup.py build
Error:
sh: mysql_config: not found
Traceback (most recent call last):
  File "./setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/home/liubing/Downloads/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/home/liubing/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found


Solution:
修改setup_posix.py文件,Line26: mysql_config:mysql_config.path = "/usr/local/mysql/bin/mysql_config"

./setup.py build
Error:
Python.h: No such file or directory

Solution:
sudo apt-get install python2.6-dev


sudo ./setup.py install
安装成功。

测试

#! /usr/bin/python
#coding=utf-8
 
import MySQLdb
 
conn = MySQLdb.connect(host='localhost',user='root',passwd='123456')
 
cursor = conn.cursor()
 
conn.select_db('test')
 
values = []
for i in range(10):
values.append(('Hello mysqldb, I am recoder '+str(i)))
 
cursor.executemany("""INSERT INTO test(title) values(%s)""",values);
cursor.close();

shell脚本创建trac项目

服务器环境:[192.168.1.3] Ubuntu 9.10 + Apache2 + svn + trac

由于apache的配置非常简单灵活,所以公司在建项目时可能会因为创建者不一样而形式不一样的习惯,比如配置文件存放的位置,虚拟目录设置路径等,所以写个脚本来规范一下,方便后续的项目维护。
#!/bin/sh
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script!"
exit 1
fi

# Check project parameters
if [ "-$1" = "-" ]; then
echo "Error: You need input project name!\nType: sudo trac-init newproject"
exit 1
fi

if [ ! -d "/home/flow/websites/$1.flow" ]; then
confpath="/etc/apache2/sites-enabled/$1.conf"

# Checkout project from svn
echo "Checkout project from svn...\n"
svn co http://192.168.1.3/svn/joomla-projects/$1.flow /home/flow/websites/$1.flow

# Add virtualhost
echo "Add virtualhost for new project...\n"
touch $confpath
echo "<virtualHost *>" >> $confpath
echo " ServerName $1.flow" >> $confpath
echo " DocumentRoot /home/flow/websites/$1.flow/trunk" >> $confpath
echo "</VirtualHost>" >> $confpath
fi

# Create new project on trac
if [ ! -d "/home/trac/$1" ]; then
echo "Create project on trac...\n"
trac-admin /home/trac/$1 initenv $1 sqlite:db/trac.db svn /home/svn/joomla-projects/$1.flow/trunk --inherit=/home/trac/test2/conf/trac.ini
chown -R www-data:www-data /home/trac/$1
trac-admin /home/trac/$1 permission add marc TRAC_ADMIN
fi

# Restart Apache...
echo "Restart Apache..."
/etc/init.d/apache2 restart

存为trac-init文件,并赋可执行权限,可将此文件拷贝到/usr/local/bin/目录下。

使用方法
sudo trac-init newproject

标签: shell trac linux