Apr4

rabbitmq启动失败问题小记

Author: leeon  Click: 19202   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]
Apr4

【转载收集】HTTP返回码备忘笔记

Author: leeon  Click: 7616   Comments: 0 Category: 网络  Tag: http,返回码

"100" : Continue
"101" : witching Protocols
"200" : OK
"201" : Created
"202" : Accepted
"203" : Non-Authoritative Information
"204" : No Content
"205" : Reset Content
"206" : Partial Content
"300" : Multiple Choices
"301" : Moved Permanently
"302" : Found
"303" : See Other
"304" : Not Modified
"305" : Use Proxy
"307" : Temporary Redirect
"400" : Bad Request
"401" : Unauthorized
"402" : Payment Required
"403" : Forbidden
"404" : Not Found
"405" : Method Not Allowed
"406" : Not Acceptable
"407" : Proxy Authentication Required
"408" : Request Time-out
"409" : Conflict
"410" : Gone
"411" : Length Required
"412" : Precondition Failed
"413" : Request Entity Too Large
"414" : Request-URI Too Large
"415" : Unsupported Media Type
"416" : Requested range not satisfiable
"417" : Expectation Failed
"500" : Internal Server Error
"501" : Not Implemented
"502" : Bad Gateway
"503" : Service Unavailable
"504" : Gateway Time-out
"505" : HTTP Version not supported

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

HTTP协议状态码表示的意思主要分为五类 ,大体是 :  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
1××
   保留   
2××
   表示请求成功地接收   
3××
   为完成请求客户需进一步细化请求   
4××
   客户错误   
5××
   服务器错误   

100 Continue
指示客户端应该继续请求。回送用于通知客户端此次请求已经收到,并且没有被服务器拒绝。
客户端应该继续发送剩下的请求数据或者请求已经完成,或者忽略回送数据。服务器必须发送
最后的回送在请求之后。

101 Switching Protocols 
服务器依照客服端请求,通过Upgrade头信息,改变当前连接的应用协议。服务器将根据Upgrade头立刻改变协议
在101回送以空行结束的时候。

 

Successful 
=================================
200 OK 
指示客服端的请求已经成功收到,解析,接受。

201 Created 
请求已经完成并一个新的返回资源被创建。被创建的资源可能是一个URI资源,通常URI资源在Location头指定。回送应该包含一个实体数据
并且包含资源特性以及location通过用户或者用户代理来选择合适的方法。实体数据格式通过煤体类型来指定即content-type头。最开始服务 器
必须创建指定的资源在返回201状态码之前。如果行为没有被立刻执行,服务器应该返回202。

202 Accepted 
请求已经被接受用来处理。但是处理并没有完成。请求可能或者根本没有遵照执行,因为处理实际执行过程中可能被拒绝。

203 Non-Authoritative Information

204 No Content 
服务器已经接受请求并且没必要返回实体数据,可能需要返回更新信息。回送可能包含新的或更新信息由entity-headers呈现。

205 Reset Content 
服务器已经接受请求并且用户代理应该重新设置文档视图。

206 Partial Content 
服务器已经接受请求GET请求资源的部分。请求必须包含一个Range头信息以指示获取范围可能必须包含If-Range头信息以成立请求条件。

Redirection 
==================================
300 Multiple Choices
请求资源符合任何一个呈现方式。

301 Moved Permanently 
请求的资源已经被赋予一个新的URI。

302 Found 
通过不同的URI请求资源的临时文件。
303 See Other

304 Not Modified 
如果客服端已经完成一个有条件的请求并且请求是允许的,但是这个文档并没有改变,服务器应该返回304状态码。304
状态码一定不能包含信息主体,从而通常通过一个头字段后的第一个空行结束。

305 Use Proxy
请求的资源必须通过代理(由Location字段指定)来访问。Location资源给出了代理的URI。

306 Unused

307 Temporary Redirect

 

Client Error 
=====================
400 Bad Request 
因为错误的语法导致服务器无法理解请求信息。

401 Unauthorized 
如果请求需要用户验证。回送应该包含一个WWW-Authenticate头字段用来指明请求资源的权限。

402 Payment Required 
保留状态码

403 Forbidden 
服务器接受请求,但是被拒绝处理。

404 Not Found 
服务器已经找到任何匹配Request-URI的资源。

405 Menthod Not Allowed 
Request-Line
 请求的方法不被允许通过指定的URI。

406 Not Acceptable

407 Proxy Authentication Required

408 Reqeust Timeout 
客服端没有提交任何请求在服务器等待处理时间内。

409 Conflict

410 Gone

411 Length Required 
服务器拒绝接受请求在没有定义Content-Length字段的情况下。

412 Precondition Failed

413 Request Entity Too Large 
服务器拒绝处理请求因为请求数据超过服务器能够处理的范围。服务器可能关闭当前连接来阻止客服端继续请求。

414 Request-URI Too Long 
服务器拒绝服务当前请求因为URI的长度超过了服务器的解析范围。

415 Unsupported Media Type 
服务器拒绝服务当前请求因为请求数据格式并不被请求的资源支持。

416 Request Range Not Satisfialbe

417 Expectation Failed

 

Server Error 
===================================
500 Internal Server Error 
服务器遭遇异常阻止了当前请求的执行

501 Not Implemented 
服务器没有相应的执行动作来完成当前请求。

502 Bad Gateway

503 Service Unavailable 
因为临时文件超载导致服务器不能处理当前请求。

504 Gateway Timeout

505 Http Version Not Supported

Mar22

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

Author: charlee  Click: 8318   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: 12169   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/),推荐阅读!

分类

标签

归档

最新评论

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的注意事项

我看过的书

链接

其他

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