Apr4

rabbitmq启动失败问题小记

Author: leeon  Click: 18220   Comments: 0 Category: linux  Tag: rabbitmq

今日安装rabbitmq学习AMQP,启动rabbitmq失败,提示以下错误:

[code="bash"]
[root@leeon sbin]# rabbitmq-server start
Activating RabbitMQ plugins ...
0 plugins activated:

ERROR: unexpected epmd error: address
[/code]

遂google找到解决方法:

It turns out this is a simple hostname resolution issue.  For reasons unknown, my mac's hostname was not resolving to an IP for an interface that was being used. This was easily solved by editing /etc/hosts and adding an entry matching the output of 'hostname' so that it always resolves to 127.0.0.1: [code="bash"]
[rob@macbook ~]$ hostname
rsmbp.local

[rob@macbook ~]$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 rsmbp rsmbp.local
[/code]

执行hostname命令查看本机主机名,然后在hosts文件中将主机名指向127.0.0.1 这里要注意的是如果主机名是rsmbp.local,那么配置的时候要使rsmbp 和 rsmbp.local 均指向127.0.0.1

就比如我自己的vps中的指向

[code="bash"]
127.0.0.1 leeon leeon.me
[/code]
Mar22

【转】关于RPM的%config和(noreplace)

Author: charlee  Click: 7412   Comments: 0 Category: linux  Tag: rpm,config,noreplace

RPM spec文件有个名为 %config 的宏,它可以标识配置文件,这样在升级时用户对配置文件做过的修改就不会丢失。没有它,用户千辛万苦修改过的配置文件会在升级过程中被覆盖。

%config也可以写成%config(noreplace),不过网上关于它的说明却屈指可数。下面是关于这两者的一些实验,都是在RedHat 9的RPM(rpm-4.2-0.69)上进行的,其他版本有可能不同。

RPM中的文件的制约条件有三个:1. 该文件在spec中如何标识(默认,%config或者%config(noreplace)); 2. 在rpm升级包中该文件是否被更新;3. 该文件是否被用户编辑过。

下表就是各个条件的组合结果。

文件标识 在RPM升级包中是否更新了? 旧版本文件未被用户编辑过 旧版本文件被用户编辑过
默认 No 用新文件覆盖 用新文件覆盖
Yes 用新文件覆盖 用新文件覆盖
%config No 用新文件覆盖 保持旧文件
Yes 用新文件覆盖 旧文件改名为.rpmsave并复制新文件
%config(noreplace) No 用新文件覆盖 保持旧文件
Yes 用新文件覆盖 保持旧文件,新文件安装为.rpmnew

其中(noreplace)有效的两种情况上存在以下的问题:当spec文件中的定义改变时会发生什么?结论如下:

文件标识 在RPM升级包中是否更新了? 旧版本文件被用户编辑过
由%config(noreplace)改为%config Yes 旧文件改名为.rpmsave并安装新文件
由%config改为%config(noreplace) Yes 保持旧文件,新文件安装为.rpmnew

结论:非配置文件或是上次安装后没有被修改的文件会被RPM包内的新文件覆盖。如果配置文件被修改过,但在新的RPM包中未作更新,则修改过的文件保留。仅当配置文件被修改并且在新的RPM包中被更新时,具体动作取决于(noreplace)。 %config使得旧文件被改名为.rpmsave并安装新文件,而%config(noreplace)将保持旧文件并将新文件安装为.rpmnew。

建议一般配置文件都标识为(noreplace),除非升级所带来的配置文件变动非常重要,使用上一版本的配置文件无法正常工作时才使用%config。

原作者博文:http://tech.idv2.com/2007/10/16/rpm-config-noreplace/

Mar22

OpenSSH与SSH2的一些小记

Author: leeon  Click: 11156   Comments: 0 Category: linux  Tag: openssh,ssh2

如果发现两台机器做公钥认证却发现怎么也授权不能,可以看看两台机器的ssh版本。

[code="bash"]
ssh -v
[/code]

查看一下两台机器的版本是否类似,有可能出现的情况是一台机器采用的openssh,而另外一台机器采用的SSH2,其实openssh和ssh2是两回事,公钥格式也不相同

SSH2的公钥写法是~/.ssh2/authorization

[code="bash"]
Key xxx.xxx
[/code]

xxx.xxx为SSH2的pubkey文件名。

如果想从openssh转SSH2可以使用命令:

[code="bash"]
ssh-keygen -e -f ~/.ssh/id_dsa.pub > ~/.ssh/id_dsa_ssh2.pub
[/code]

从SSH2转openssh可以使用命令:

[code="bash"]
ssh-keygen -i -f ~/.ssh/id_dsa_1024_a.pub > ~/.ssh/id_dsa_1024_a_openssh.pub
[/code]

其实SSH的种类很多,查了下资料有如下解释:

 SSH
    A generic term referring to SSH protocols or software products.
SSH-1
    The SSH protocol, Version 1. This protocol went through several
    revisions, of which 1.3 and 1.5 are the best known, and we will
    write SSH-1.3 and SSH-1.5 should the distinction be necessary.
SSH-2
    The SSH protocol, Version 2, as defined by several draft standards
    documents of the IETF SECSH working group.
SSH1
    Tatu Ylönen's software implementing the SSH-1 protocol; the original
    SSH. Now distributed and maintained (minimally) by SSH
    Communications Security, Inc.
SSH2
    The "SSH Secure Shell" product from SSH Communications Security, Inc.
    This is a commercial SSH-2 protocol implementation, though it is
    licensed free of charge in some circumstances.
ssh (all lowercase letters)
    A client program included in SSH1, SSH2, OpenSSH, F-Secure SSH, and
    other products, for running secure terminal sessions and remote
    commands. In SSH1 and SSH2, it is also named ssh1/ssh2, respectively.
OpenSSH
    The product OpenSSH from the OpenBSD project,
    which implements both the SSH-1 and SSH-2 protocols.
OpenSSH/1
    OpenSSH, referring specifically to its behavior
    when using the SSH-1 protocol.
OpenSSH/2
    OpenSSH, referring specifically to its behavior
    when using the SSH-2 protocol.

 

 这篇文章不错(http://blog.urdada.net/2008/01/03/70/),推荐阅读!

Feb18

resolv.conf配置问题小记

Author: leeon  Click: 6849   Comments: 0 Category: linux  Tag: resolv,nslookup,ping,dns

今日有一需求是需要将一台server配置DNS,配置本地的DNS解析,在/etc/resolv.conf下加入两条nameserver的记录,配置完后,用ping命令测试是否可以正常解析,但命令提示如下:

[code="bash"]
Tencent:~ # ping www.XXXX.com
ping: unknown host www.XXXX.com
[/code]

但是nslookup命令却可以正常解析内部域名。

于是乎修改/etc/nsswitch.conf文件。

在:

[code="bash"]
hosts: files
[/code]

中加入 “dns”

[code="bash"]
hosts: files dns
[/code]

使系统在查找host对应ip的时候不只是去查找/etc/hosts文件,也利用DNS查询的方式来解析IP。

最后别忘了重启nscd服务

分类

标签

归档

最新评论

Abyss在00:04:28评论了
Linux中ramdisk,tmpfs,ramfs的介绍与性能测试
shallwe99在10:21:17评论了
【原创】如何在微信小程序开发中正确的使用vant ui组件
默一在09:04:53评论了
Berkeley DB 由浅入深【转自架构师杨建】
Memory在14:09:22评论了
【原创】最佳PHP框架选择(phalcon,yaf,laravel,thinkphp,yii)
leo在17:57:04评论了
shell中使用while循环ssh的注意事项

我看过的书

链接

其他

访问本站种子 本站平均热度:8823 c° 本站链接数:1 个 本站标签数:464 个 本站被评论次数:94 次