分布式搜索elasticsearch概念解析(四)

elasticsearch几个概念解析:
cluster
     代表一个集群,集群中有多个节点,其中有一个为主节点,这个主节点是可以通过选举产生的,主从节点是对于集群内部来说的。es的一个概念就是去中心化,字面上理解就是无中心节点,这是对于集群外部来说的,因为从外部来看es集群,在逻辑上是个整体,你与任何一个节点的通信和与整个es集群通信是等价的。

node
    node是elasticsearch的运行实例。为了测试,多个node可以在同一台服务器上启动,但是通常一个服务器只放一个node。系统启动时,node会使用广播(或指定的多播)来发现一个现有的cluster,并且试图加入该cluster。

shard
     代表索引分片,es可以把一个完整的索引分成多个分片,这样的好处是可以把一个大的索引拆分成多个,分布到不同的节点上。构成分布式搜索。分片的数量只能在索引创建前指定,并且索引创建后不能更改。一个shard是一个单独的lucene实例,是被elasticsearch自动管理的底层工作单元。一个索引是包含primary或replia切片的逻辑命名空间。除了需要定义primary shards和replia shards的数量以外,你不需要直接指定使用的shards,你的代码中只关心index就好。Elasticsearch在集群中分布所有的 shards,并且在添加删除节点时,自动重新分配。

primary shard
    每个document都存储在一个单独的primary shard中。当为一个document建索引时,首先在primary shard上建立,然后在该primary shard的所有replica shards上面建。
默认的,每个索引有5个primary shards。你可以通过减少或增加primary shards的数量来伸缩你的索引能够接受的文档数量。
当索引创建以后,你不能够改变索引中primary shards的数量。

replicas
     代表索引副本,es可以设置多个索引的副本,副本的作用一是提高系统的容错性,当个某个节点某个分片损坏或丢失时可以从副本中恢复。二是提高es的查询效率,es会自动对搜索请求进行负载均衡。

routing

     当为某个document建立索引的时候,索引存储在某个primary shard上。该shard是通过哈希routing value选出来的。默认的,routing value通过document ID得到,或者当该文档有特定的父文档,从父文档的ID得到(这是为了保证子文档和父文档存储在相同的shard)。该value可以在建索引时指定,或者在mapping中通过routing field给定。

recovery
     代表数据恢复或叫数据重新分布,es在有节点加入或退出时会根据机器的负载对索引分片进行重新分配,挂掉的节点重新启动时也会进行数据恢复。

river
     代表es的一个数据源,也是其它存储方式(如:数据库)同步数据到es的一个方法。它是以插件方式存在的一个es服务,通过读取river中的数据并把它索引到es中,官方的river有couchDB的,RabbitMQ的,Twitter的,Wikipedia的,river这个功能将会在后面的文件中重点说到。

gateway
     代表es索引的持久化存储方式,es默认是先把索引存放到内存中,当内存满了时再持久化到硬盘。当这个es集群关闭再重新启动时就会从gateway中读取索引数据。es支持多种类型的gateway,有本地文件系统(默认),分布式文件系统,Hadoop的HDFS和amazon的s3云存储服务。

discovery.zen
     代表es的自动发现节点机制,es是一个基于p2p的系统,它先通过广播寻找存在的节点,再通过多播协议来进行节点之间的通信,同时也支持点对点的交互。

Transport
     代表es内部节点或集群与客户端的交互方式,默认内部是使用tcp协议进行交互,同时它支持http协议(json格式)、thrift、servlet、memcached、zeroMQ等的传输协议(通过插件方式集成)。

分布式搜索Elasticsearch插件安装(三)

1
2
3
4
5
6
安装head插件
[root@localhost bin]# ./plugin -install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying https://github.com/mobz/elasticsearch-head/archive/master.zip...
Downloading .......................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Installed mobz/elasticsearch-head into /opt/elasticsearch-1.7.1/plugins/head

head

1
2
3
4
5
6
7
安装bigdesk插件
[root@localhost bin]# ./plugin -install lukas-vlcek/bigdesk
-> Installing lukas-vlcek/bigdesk...
Trying https://github.com/lukas-vlcek/bigdesk/archive/master.zip...
Downloading ........................................................................................................................................................................................................................................................DONE
Installed lukas-vlcek/bigdesk into /opt/elasticsearch-1.7.1/plugins/bigdesk
Identified as a _site plugin, moving to _site structure ...

bigdesk

1
2
3
4
5
6
7
安装marvel插件
[root@localhost bin]# ./plugin -i elasticsearch/marvel/latest
-> Installing elasticsearch/marvel/latest...
Trying http://download.elasticsearch.org/elasticsearch/marvel/marvel-latest.zip...
Downloading .................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Installed elasticsearch/marvel/latest into /opt/elasticsearch-1.7.1/plugins/marvel
[root@localhost bin]#

marvel

分布式搜索Elasticsearch单机安装(二)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
步骤一:安装Java环境
 
下载Java最新程序
 
http://javadl.oracle.com/webapps/download/AutoDL?BundleId=207220
 
查看java version[root@localhost ~]# java -version
java version "1.7.0_99"
OpenJDK Runtime Environment (rhel-2.6.5.0.el6_7-x86_64 u99-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
[root@localhost ~]# 
 
步骤二:配置本机环境变量
 
export JAVA_HOME=/usr/java/jre1.8.0_77
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 
 
步骤三:下载Elasticsearch程序
 
https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.2.1/elasticsearch-2.2.1.tar.gz
 
步骤四:解压程序
 
[root@localhost opt]#tar xf elasticsearch-2.2.1.tar.gz 
 
 
步骤五:运行程序
 
[elk@localhost bin]$ ./elasticsearch –d
 
 
步骤六:检查运行
 
[elk@localhost bin]$ curl -XGxt http://localhost:9200/
{
  "name" : "Iron Man",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.2.1",
    "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1",
    "build_timestamp" : "2016-03-09T09:38:54Z",
    "build_snapshot" : false,
    "lucene_version" : "5.4.1"
  },
  "tagline" : "You Know, for Search"
}

分布式搜索Elasticsearch历史(一)

Elasticsearch是一个基于Apache Lucene(TM)的开源搜索引擎。无论在开源还是专有领域,Lucene可以被认为是迄今为止最先进、性能最好的、功能最全的搜索引擎库。

但是,Lucene只是一个库。想要使用它,你必须使用Java来作为开发语言并将其直接集成到你的应用中,更糟糕的是,Lucene非常复杂,你需要深入了解检索的相关知识来理解它是如何工作的。

Elasticsearch也使用Java开发并使用Lucene作为其核心来实现所有索引和搜索的功能,但是它的目的是通过简单的RESTful API来隐藏Lucene的复杂性,从而让全文搜索变得简单。

不过,Elasticsearch不仅仅是Lucene和全文搜索,我们还能这样去描述它:

  • 分布式的实时文件存储,每个字段都被索引并可被搜索
  • 分布式的实时分析搜索引擎
  • 可以扩展到上百台服务器,处理PB级结构化或非结构化数据

而且,所有的这些功能被集成到一个服务里面,你的应用可以通过简单的RESTful API、各种语言的客户端甚至命令行与之交互。

上手Elasticsearch非常容易。它提供了许多合理的缺省值,并对初学者隐藏了复杂的搜索引擎理论。它开箱即用(安装即可使用),只需很少的学习既可在生产环境中使用。

Elasticsearch在Apache 2 license下许可使用,可以免费下载、使用和修改。

随着你对Elasticsearch的理解加深,你可以根据不同的问题领域定制Elasticsearch的高级特性,这一切都是可配置的,并且配置非常灵活。


模糊的历史

多年前,一个叫做Shay Banon的刚结婚不久的失业开发者,由于妻子要去伦敦学习厨师,他便跟着也去了。在他找工作的过程中,为了给妻子构建一个食谱的搜索引擎,他开始构建一个早期版本的Lucene。

直接基于Lucene工作会比较困难,所以Shay开始抽象Lucene代码以便Java程序员可以在应用中添加搜索功能。他发布了他的第一个开源项目,叫做“Compass”。

后来Shay找到一份工作,这份工作处在高性能和内存数据网格的分布式环境中,因此高性能的、实时的、分布式的搜索引擎也是理所当然需要的。然后他决定重写Compass库使其成为一个独立的服务叫做Elasticsearch。

第一个公开版本出现在2010年2月,在那之后Elasticsearch已经成为 Github上最受欢迎的项目之一,代码贡献者超过300人。一家主营Elasticsearch的公司就此成立,他们一边提供商业支持一边开发新功能,不过Elasticsearch将永远开源且对所有人可用。

Shay的妻子依旧等待着她的食谱搜索……

elasticsearch不能用root用户运行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@localhost bin]# ./elasticsearch -d
[root@localhost bin]# Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
创建elk用户:elk:x:500:500::/home/elk:/bin/bash
赋予权限:
 
[root@localhost opt]# chown -R elk.elk elasticsearch-2.2.1
切换elk帐户:
 
[root@localhost elasticsearch-2.2.1]# su elk
启动elasticsearch:
 
[elk@localhost bin]$ ./elasticsearch -d
检查是否启动:[elk@localhost bin]$ curl -XGxt http://localhost:9200/
{
  "name" : "Iron Man",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.2.1",
    "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1",
    "build_timestamp" : "2016-03-09T09:38:54Z",
    "build_snapshot" : false,
    "lucene_version" : "5.4.1"
  },
  "tagline" : "You Know, for Search"
}

Docker 使用Aliyun源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
阿里云是最近新出的一个镜像源。得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源。
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/
 
CentOS系统更换软件安装源
第一步:备份你的原镜像文件,以免出错后可以恢复。
 
[root@f660c232f698 /]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
 
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
 
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
 
[root@f660c232f698 /]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
 
第三步:运行yum makecache生成缓存
[root@f660c232f698 /]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@f660c232f698 /]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                         | 3.7 kB     00:00     
base/group_gz                                                                                                                | 219 kB     00:00     
base/filelists_db                                                                                                            | 6.3 MB     00:06     
base/primary_db                                                                                                              | 4.6 MB     00:04     
base/other_db                                                                                                                | 2.8 MB     00:02     
extras                                                                                                                       | 3.4 kB     00:00     
extras/filelists_db                                                                                                          |  37 kB     00:00     
extras/prestodelta                                                                                                           |  703 B     00:00     
extras/primary_db                                                                                                            |  34 kB     00:00     
extras/other_db                                                                                                              |  48 kB     00:00     
updates                                                                                                                      | 3.4 kB     00:00     
updates/filelists_db                                                                                                         | 3.1 MB     00:03     
updates/prestodelta                                                                                                          | 471 kB     00:00     
updates/primary_db                                                                                                           | 4.0 MB     00:04     
updates/other_db                                                                                                             |  47 MB     00:47     
Metadata Cache Created
[root@f660c232f698 /]#

Docker容器配置SSH服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
安装ssh服务
[root@f9be7c6c1a52 /]# yum install openssh-server -y
Loaded plugins: fastestmirror
Setting up Install Process
base                                                                                                                         | 3.7 kB     00:00     
base/primary_db                                                                                                              | 4.6 MB     00:02     
extras                                                                                                                       | 3.4 kB     00:00     
extras/primary_db                                                                                                            |  34 kB     00:00     
updates                                                                                                                      | 3.4 kB     00:00     
updates/primary_db                                                                                                           | 4.6 MB     00:13     
Resolving Dependencies
--> Running transaction check
---> Package openssh-server.i686 0:5.3p1-112.el6_7 will be updated
---> Package openssh-server.x86_64 0:5.3p1-114.el6_7 will be an update
--> Processing Dependency: openssh = 5.3p1-114.el6_7 for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libutil.so.1(GLIBC_2.2.5)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libpam.so.0(LIBPAM_1.0)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.6)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.2)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libkrb5.so.3(krb5_3_MIT)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libgssapi_krb5.so.2(gssapi_krb5_2_MIT)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.1)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcrypt.so.1(GLIBC_2.2.5)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.8)(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libz.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libwrap.so.0()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libutil.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libselinux.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libresolv.so.2()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libpam.so.0()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libnss3.so()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libnsl.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libkrb5.so.3()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libk5crypto.so.3()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libgssapi_krb5.so.2()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libfipscheck.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libdl.so.2()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcrypto.so.10()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcrypt.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libcom_err.so.2()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libaudit.so.1()(64bit) for package: openssh-server-5.3p1-114.el6_7.x86_64
--> Running transaction check
---> Package audit-libs.x86_64 0:2.3.7-5.el6 will be installed
---> Package fipscheck-lib.x86_64 0:1.2.0-7.el6 will be installed
---> Package glibc.x86_64 0:2.12-1.166.el6_7.7 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3)(64bit) for package: glibc-2.12-1.166.el6_7.7.x86_64
--> Processing Dependency: libfreebl3.so()(64bit) for package: glibc-2.12-1.166.el6_7.7.x86_64
---> Package krb5-libs.i686 0:1.10.3-42.el6 will be updated
---> Package krb5-libs.i686 0:1.10.3-42z1.el6_7 will be an update
---> Package krb5-libs.x86_64 0:1.10.3-42z1.el6_7 will be installed
--> Processing Dependency: libkeyutils.so.1(KEYUTILS_0.3)(64bit) for package: krb5-libs-1.10.3-42z1.el6_7.x86_64
--> Processing Dependency: libkeyutils.so.1()(64bit) for package: krb5-libs-1.10.3-42z1.el6_7.x86_64
---> Package libcom_err.x86_64 0:1.41.12-22.el6 will be installed
---> Package libselinux.x86_64 0:2.0.94-5.8.el6 will be installed
---> Package nss.x86_64 0:3.19.1-8.el6_7 will be installed
--> Processing Dependency: nss-softokn(x86-64) >= 3.14.3-22 for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.17.1)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.15)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.14)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.13)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.12.5)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.12.3)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.12)(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libsoftokn3.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libplds4.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libplc4.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssutil3.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssdbm3.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnspr4.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
---> Package openssh.i686 0:5.3p1-112.el6_7 will be updated
--> Processing Dependency: openssh = 5.3p1-112.el6_7 for package: openssh-clients-5.3p1-112.el6_7.i686
---> Package openssh.x86_64 0:5.3p1-114.el6_7 will be an update
---> Package openssl.i686 0:1.0.1e-42.el6_7.2 will be updated
---> Package openssl.i686 0:1.0.1e-42.el6_7.4 will be an update
---> Package openssl.x86_64 0:1.0.1e-42.el6_7.4 will be installed
---> Package pam.x86_64 0:1.1.1-20.el6_7.1 will be installed
--> Processing Dependency: libdb-4.7.so()(64bit) for package: pam-1.1.1-20.el6_7.1.x86_64
--> Processing Dependency: libcrack.so.2()(64bit) for package: pam-1.1.1-20.el6_7.1.x86_64
---> Package tcp_wrappers-libs.x86_64 0:7.6-57.el6 will be installed
---> Package zlib.x86_64 0:1.2.3-29.el6 will be installed
--> Running transaction check
---> Package cracklib.x86_64 0:2.8.16-4.el6 will be installed
---> Package db4.x86_64 0:4.7.25-20.el6_7 will be installed
---> Package keyutils-libs.x86_64 0:1.4-5.el6 will be installed
---> Package nspr.x86_64 0:4.10.8-2.el6_7 will be installed
---> Package nss-softokn.x86_64 0:3.14.3-23.el6_7 will be installed
--> Processing Dependency: libsqlite3.so.0()(64bit) for package: nss-softokn-3.14.3-23.el6_7.x86_64
---> Package nss-softokn-freebl.x86_64 0:3.14.3-23.el6_7 will be installed
---> Package nss-util.i686 0:3.19.1-2.el6_7 will be updated
---> Package nss-util.i686 0:3.19.1-5.el6_7 will be an update
---> Package nss-util.x86_64 0:3.19.1-5.el6_7 will be installed
---> Package openssh-clients.i686 0:5.3p1-112.el6_7 will be updated
---> Package openssh-clients.x86_64 0:5.3p1-114.el6_7 will be an update
--> Processing Dependency: libncurses.so.5()(64bit) for package: openssh-clients-5.3p1-114.el6_7.x86_64
--> Processing Dependency: libedit.so.0()(64bit) for package: openssh-clients-5.3p1-114.el6_7.x86_64
--> Running transaction check
---> Package libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be installed
---> Package ncurses-libs.x86_64 0:5.7-4.20090207.el6 will be installed
---> Package sqlite.x86_64 0:3.6.20-1.el6_7.2 will be installed
--> Processing Dependency: libreadline.so.6()(64bit) for package: sqlite-3.6.20-1.el6_7.2.x86_64
--> Running transaction check
---> Package readline.x86_64 0:6.0-4.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
====================================================================================================================================================
 Package                                Arch                       Version                                        Repository                   Size
====================================================================================================================================================
Updating:
 openssh-server                         x86_64                     5.3p1-114.el6_7                                updates                     324 k
Installing for dependencies:
 audit-libs                             x86_64                     2.3.7-5.el6                                    base                         71 k
 cracklib                               x86_64                     2.8.16-4.el6                                   base                         70 k
 db4                                    x86_64                     4.7.25-20.el6_7                                updates                     563 k
 fipscheck-lib                          x86_64                     1.2.0-7.el6                                    base                        8.3 k
 glibc                                  x86_64                     2.12-1.166.el6_7.7                             updates                     3.8 M
 keyutils-libs                          x86_64                     1.4-5.el6                                      base                         20 k
 krb5-libs                              x86_64                     1.10.3-42z1.el6_7                              updates                     769 k
 libcom_err                             x86_64                     1.41.12-22.el6                                 base                         37 k
 libedit                                x86_64                     2.11-4.20080712cvs.1.el6                       base                         74 k
 libselinux                             x86_64                     2.0.94-5.8.el6                                 base                        108 k
 ncurses-libs                           x86_64                     5.7-4.20090207.el6                             base                        245 k
 nspr                                   x86_64                     4.10.8-2.el6_7                                 updates                     113 k
 nss                                    x86_64                     3.19.1-8.el6_7                                 updates                     857 k
 nss-softokn                            x86_64                     3.14.3-23.el6_7                                updates                     262 k
 nss-softokn-freebl                     x86_64                     3.14.3-23.el6_7                                updates                     167 k
 nss-util                               x86_64                     3.19.1-5.el6_7                                 updates                      67 k
 openssl                                x86_64                     1.0.1e-42.el6_7.4                              updates                     1.5 M
 pam                                    x86_64                     1.1.1-20.el6_7.1                               updates                     658 k
 readline                               x86_64                     6.0-4.el6                                      base                        178 k
 sqlite                                 x86_64                     3.6.20-1.el6_7.2                               updates                     300 k
 tcp_wrappers-libs                      x86_64                     7.6-57.el6                                     base                         62 k
 zlib                                   x86_64                     1.2.3-29.el6                                   base                         73 k
Updating for dependencies:
 krb5-libs                              i686                       1.10.3-42z1.el6_7                              updates                     777 k
 nss-util                               i686                       3.19.1-5.el6_7                                 updates                      66 k
 openssh                                x86_64                     5.3p1-114.el6_7                                updates                     274 k
 openssh-clients                        x86_64                     5.3p1-114.el6_7                                updates                     439 k
 openssl                                i686                       1.0.1e-42.el6_7.4                              updates                     1.5 M
 
Transaction Summary
====================================================================================================================================================
Install      22 Package(s)
Upgrade       6 Package(s)
 
Total download size: 13 M
Downloading Packages:
(1/28): audit-libs-2.3.7-5.el6.x86_64.rpm                                                                                    |  71 kB     00:00     
(2/28): cracklib-2.8.16-4.el6.x86_64.rpm                                                                                     |  70 kB     00:00     
(3/28): db4-4.7.25-20.el6_7.x86_64.rpm                                                                                       | 563 kB     00:01     
(4/28): fipscheck-lib-1.2.0-7.el6.x86_64.rpm                                                                                 | 8.3 kB     00:00     
(5/28): glibc-2.12-1.166.el6_7.7.x86_64.rpm                                                                                  | 3.8 MB     00:05     
(6/28): keyutils-libs-1.4-5.el6.x86_64.rpm                                                                                   |  20 kB     00:00     
(7/28): krb5-libs-1.10.3-42z1.el6_7.i686.rpm                                                                                 | 777 kB     00:01     
(8/28): krb5-libs-1.10.3-42z1.el6_7.x86_64.rpm                                                                               | 769 kB     00:02     
(9/28): libcom_err-1.41.12-22.el6.x86_64.rpm                                                                                 |  37 kB     00:00     
(10/28): libedit-2.11-4.20080712cvs.1.el6.x86_64.rpm                                                                         |  74 kB     00:00     
(11/28): libselinux-2.0.94-5.8.el6.x86_64.rpm                                                                                | 108 kB     00:00     
(12/28): ncurses-libs-5.7-4.20090207.el6.x86_64.rpm                                                                          | 245 kB     00:00     
(13/28): nspr-4.10.8-2.el6_7.x86_64.rpm                                                                                      | 113 kB     00:00     
(14/28): nss-3.19.1-8.el6_7.x86_64.rpm                                                                                       | 857 kB     00:04     
(15/28): nss-softokn-3.14.3-23.el6_7.x86_64.rpm                                                                              | 262 kB     00:01     
(16/28): nss-softokn-freebl-3.14.3-23.el6_7.x86_64.rpm                                                                       | 167 kB     00:01     
(17/28): nss-util-3.19.1-5.el6_7.i686.rpm                                                                                    |  66 kB     00:00     
(18/28): nss-util-3.19.1-5.el6_7.x86_64.rpm                                                                                  |  67 kB     00:00     
(19/28): openssh-5.3p1-114.el6_7.x86_64.rpm                                                                                  | 274 kB     00:02     
(20/28): openssh-clients-5.3p1-114.el6_7.x86_64.rpm                                                                          | 439 kB     00:04     
(21/28): openssh-server-5.3p1-114.el6_7.x86_64.rpm                                                                           | 324 kB     00:03     
(22/28): openssl-1.0.1e-42.el6_7.4.i686.rpm                                                                                  | 1.5 MB     00:18     
(23/28): openssl-1.0.1e-42.el6_7.4.x86_64.rpm                                                                                | 1.5 MB     00:19     
(24/28): pam-1.1.1-20.el6_7.1.x86_64.rpm                                                                                     | 658 kB     00:10     
(25/28): readline-6.0-4.el6.x86_64.rpm                                                                                       | 178 kB     00:00     
(26/28): sqlite-3.6.20-1.el6_7.2.x86_64.rpm                                                                                  | 300 kB     00:03     
(27/28): tcp_wrappers-libs-7.6-57.el6.x86_64.rpm                                                                             |  62 kB     00:00     
(28/28): zlib-1.2.3-29.el6.x86_64.rpm                                                                                        |  73 kB     00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                               158 kB/s |  13 MB     01:26     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-7.el6.centos.12.3.i686 (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
libcrypto.so.10()(64bit) is needed by openssh-5.3p1-114.el6_7.x86_64
libcrypto.so.10(OPENSSL_1.0.1)(64bit) is needed by openssh-5.3p1-114.el6_7.x86_64
libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit) is needed by openssh-5.3p1-114.el6_7.x86_64
libcrypto.so.10(libcrypto.so.10)(64bit) is needed by openssh-5.3p1-114.el6_7.x86_64
libcrypto.so.10()(64bit) is needed by openssh-server-5.3p1-114.el6_7.x86_64
libcrypto.so.10(OPENSSL_1.0.1)(64bit) is needed by openssh-server-5.3p1-114.el6_7.x86_64
libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit) is needed by openssh-server-5.3p1-114.el6_7.x86_64
libcrypto.so.10(libcrypto.so.10)(64bit) is needed by openssh-server-5.3p1-114.el6_7.x86_64
libcrypto.so.10()(64bit) is needed by openssh-clients-5.3p1-114.el6_7.x86_64
libcrypto.so.10(OPENSSL_1.0.1)(64bit) is needed by openssh-clients-5.3p1-114.el6_7.x86_64
libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit) is needed by openssh-clients-5.3p1-114.el6_7.x86_64
libcrypto.so.10(libcrypto.so.10)(64bit) is needed by openssh-clients-5.3p1-114.el6_7.x86_64
libgssapi_krb5.so.2 is needed by openssl-1.0.1e-42.el6_7.4.i686
libk5crypto.so.3 is needed by openssl-1.0.1e-42.el6_7.4.i686
libk5crypto.so.3(k5crypto_3_MIT) is needed by openssl-1.0.1e-42.el6_7.4.i686
libkrb5.so.3 is needed by openssl-1.0.1e-42.el6_7.4.i686
libkrb5.so.3(krb5_3_MIT) is needed by openssl-1.0.1e-42.el6_7.4.i686
libgssapi_krb5.so.2 is needed by (installed) libcurl-7.19.7-46.el6.i686
libgssapi_krb5.so.2 is needed by (installed) curl-7.19.7-46.el6.i686
libgssapi_krb5.so.2(gssapi_krb5_2_MIT) is needed by (installed) libcurl-7.19.7-46.el6.i686
libk5crypto.so.3 is needed by (installed) libcurl-7.19.7-46.el6.i686
libk5crypto.so.3 is needed by (installed) curl-7.19.7-46.el6.i686
libkrb5.so.3 is needed by (installed) libcurl-7.19.7-46.el6.i686
libkrb5.so.3 is needed by (installed) curl-7.19.7-46.el6.i686
libnssutil3.so is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so is needed by (installed) nss-sysinit-3.19.1-8.el6_7.i686
libnssutil3.so is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so is needed by (installed) libcurl-7.19.7-46.el6.i686
libnssutil3.so is needed by (installed) curl-7.19.7-46.el6.i686
libnssutil3.so is needed by (installed) openldap-2.4.40-7.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-sysinit-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.3) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.3) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.5) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.7) is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.13) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.13) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.14) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.14) is needed by (installed) nss-sysinit-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.14) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.15) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.15) is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.17.1) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.17.1) is needed by (installed) nss-3.19.1-8.el6_7.i686
 You could try running: rpm -Va --nofiles --nodigest
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx-2016-03-20-17-11NiU4oE.yumtx
[root@f9be7c6c1a52 /]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
安装passwd服务(需要设定密码)
[root@f9be7c6c1a52 /]# yum install passwd -y  
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
 * base: mirrors.skyshe.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package passwd.x86_64 0:0.77-4.el6_2.2 will be installed
--> Processing Dependency: libpopt.so.0(LIBPOPT_0)(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libpam_misc.so.0(LIBPAM_MISC_1.0)(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libpam.so.0(LIBPAM_1.0)(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.4)(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libuser.so.1()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libselinux.so.1()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libpopt.so.0()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libpam_misc.so.0()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libpam.so.0()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libgobject-2.0.so.0()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libgmodule-2.0.so.0()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libglib-2.0.so.0()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libcrypt.so.1()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Processing Dependency: libaudit.so.1()(64bit) for package: passwd-0.77-4.el6_2.2.x86_64
--> Running transaction check
---> Package audit-libs.x86_64 0:2.3.7-5.el6 will be installed
---> Package glib2.x86_64 0:2.28.8-4.el6 will be installed
--> Processing Dependency: libz.so.1(ZLIB_1.2.2)(64bit) for package: glib2-2.28.8-4.el6.x86_64
--> Processing Dependency: libz.so.1()(64bit) for package: glib2-2.28.8-4.el6.x86_64
--> Processing Dependency: libfam.so.0()(64bit) for package: glib2-2.28.8-4.el6.x86_64
---> Package glibc.x86_64 0:2.12-1.166.el6_7.7 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3)(64bit) for package: glibc-2.12-1.166.el6_7.7.x86_64
--> Processing Dependency: libfreebl3.so()(64bit) for package: glibc-2.12-1.166.el6_7.7.x86_64
---> Package libselinux.x86_64 0:2.0.94-5.8.el6 will be installed
---> Package libuser.x86_64 0:0.56.13-8.el6_7 will be installed
--> Processing Dependency: libldap-2.4.so.2()(64bit) for package: libuser-0.56.13-8.el6_7.x86_64
---> Package pam.x86_64 0:1.1.1-20.el6_7.1 will be installed
--> Processing Dependency: libdb-4.7.so()(64bit) for package: pam-1.1.1-20.el6_7.1.x86_64
--> Processing Dependency: libcrack.so.2()(64bit) for package: pam-1.1.1-20.el6_7.1.x86_64
---> Package popt.x86_64 0:1.13-7.el6 will be installed
--> Running transaction check
---> Package cracklib.x86_64 0:2.8.16-4.el6 will be installed
---> Package db4.x86_64 0:4.7.25-20.el6_7 will be installed
---> Package gamin.x86_64 0:0.1.10-9.el6 will be installed
---> Package nss-softokn-freebl.x86_64 0:3.14.3-23.el6_7 will be installed
---> Package openldap.x86_64 0:2.4.40-7.el6_7 will be installed
--> Processing Dependency: libssl3.so(NSS_3.7.4)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libssl3.so(NSS_3.4)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libssl3.so(NSS_3.2)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libssl3.so(NSS_3.14)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.9.3)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.9.2)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.8)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.6)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.4)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.3)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.2)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.12.9)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.12.5)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.12.1)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.12)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.11.1)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.11)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so(NSS_3.10)(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libssl3.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libsmime3.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libsasl2.so.2()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libplds4.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libplc4.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnssutil3.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnss3.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
--> Processing Dependency: libnspr4.so()(64bit) for package: openldap-2.4.40-7.el6_7.x86_64
---> Package zlib.x86_64 0:1.2.3-29.el6 will be installed
--> Running transaction check
---> Package cyrus-sasl-lib.x86_64 0:2.1.23-15.el6_6.2 will be installed
---> Package nspr.x86_64 0:4.10.8-2.el6_7 will be installed
---> Package nss.x86_64 0:3.19.1-8.el6_7 will be installed
--> Processing Dependency: nss-softokn(x86-64) >= 3.14.3-22 for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libsoftokn3.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
--> Processing Dependency: libnssdbm3.so()(64bit) for package: nss-3.19.1-8.el6_7.x86_64
---> Package nss-util.i686 0:3.19.1-2.el6_7 will be updated
---> Package nss-util.i686 0:3.19.1-5.el6_7 will be an update
---> Package nss-util.x86_64 0:3.19.1-5.el6_7 will be installed
--> Running transaction check
---> Package nss-softokn.x86_64 0:3.14.3-23.el6_7 will be installed
--> Processing Dependency: libsqlite3.so.0()(64bit) for package: nss-softokn-3.14.3-23.el6_7.x86_64
--> Running transaction check
---> Package sqlite.x86_64 0:3.6.20-1.el6_7.2 will be installed
--> Processing Dependency: libreadline.so.6()(64bit) for package: sqlite-3.6.20-1.el6_7.2.x86_64
--> Running transaction check
---> Package readline.x86_64 0:6.0-4.el6 will be installed
--> Processing Dependency: libtinfo.so.5()(64bit) for package: readline-6.0-4.el6.x86_64
--> Running transaction check
---> Package ncurses-libs.x86_64 0:5.7-4.20090207.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
====================================================================================================================================================
 Package                                  Arch                         Version                                  Repository                     Size
====================================================================================================================================================
Installing:
 passwd                                   x86_64                       0.77-4.el6_2.2                           base                           89 k
Installing for dependencies:
 audit-libs                               x86_64                       2.3.7-5.el6                              base                           71 k
 cracklib                                 x86_64                       2.8.16-4.el6                             base                           70 k
 cyrus-sasl-lib                           x86_64                       2.1.23-15.el6_6.2                        base                          136 k
 db4                                      x86_64                       4.7.25-20.el6_7                          updates                       563 k
 gamin                                    x86_64                       0.1.10-9.el6                             base                          122 k
 glib2                                    x86_64                       2.28.8-4.el6                             base                          1.7 M
 glibc                                    x86_64                       2.12-1.166.el6_7.7                       updates                       3.8 M
 libselinux                               x86_64                       2.0.94-5.8.el6                           base                          108 k
 libuser                                  x86_64                       0.56.13-8.el6_7                          updates                       368 k
 ncurses-libs                             x86_64                       5.7-4.20090207.el6                       base                          245 k
 nspr                                     x86_64                       4.10.8-2.el6_7                           updates                       113 k
 nss                                      x86_64                       3.19.1-8.el6_7                           updates                       857 k
 nss-softokn                              x86_64                       3.14.3-23.el6_7                          updates                       262 k
 nss-softokn-freebl                       x86_64                       3.14.3-23.el6_7                          updates                       167 k
 nss-util                                 x86_64                       3.19.1-5.el6_7                           updates                        67 k
 openldap                                 x86_64                       2.4.40-7.el6_7                           updates                       282 k
 pam                                      x86_64                       1.1.1-20.el6_7.1                         updates                       658 k
 popt                                     x86_64                       1.13-7.el6                               base                           39 k
 readline                                 x86_64                       6.0-4.el6                                base                          178 k
 sqlite                                   x86_64                       3.6.20-1.el6_7.2                         updates                       300 k
 zlib                                     x86_64                       1.2.3-29.el6                             base                           73 k
Updating for dependencies:
 nss-util                                 i686                         3.19.1-5.el6_7                           updates                        66 k
 
Transaction Summary
====================================================================================================================================================
Install      22 Package(s)
Upgrade       1 Package(s)
 
Total size: 10 M
Total download size: 2.7 M
Downloading Packages:
(1/7): cyrus-sasl-lib-2.1.23-15.el6_6.2.x86_64.rpm                                                                           | 136 kB     00:00     
(2/7): gamin-0.1.10-9.el6.x86_64.rpm                                                                                         | 122 kB     00:00     
(3/7): glib2-2.28.8-4.el6.x86_64.rpm                                                                                         | 1.7 MB     00:01     
(4/7): libuser-0.56.13-8.el6_7.x86_64.rpm                                                                                    | 368 kB     00:00     
(5/7): openldap-2.4.40-7.el6_7.x86_64.rpm                                                                                    | 282 kB     00:00     
(6/7): passwd-0.77-4.el6_2.2.x86_64.rpm                                                                                      |  89 kB     00:00     
(7/7): popt-1.13-7.el6.x86_64.rpm                                                                                            |  39 kB     00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                               1.3 MB/s | 2.7 MB     00:02     
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
libnssutil3.so is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so is needed by (installed) nss-sysinit-3.19.1-8.el6_7.i686
libnssutil3.so is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so is needed by (installed) libcurl-7.19.7-46.el6.i686
libnssutil3.so is needed by (installed) curl-7.19.7-46.el6.i686
libnssutil3.so is needed by (installed) openldap-2.4.40-7.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-sysinit-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12) is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.3) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.3) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.5) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.12.7) is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.13) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.13) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.14) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.14) is needed by (installed) nss-sysinit-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.14) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.15) is needed by (installed) nss-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.15) is needed by (installed) nss-tools-3.19.1-8.el6_7.i686
libnssutil3.so(NSSUTIL_3.17.1) is needed by (installed) nss-softokn-3.14.3-23.el6_7.i686
libnssutil3.so(NSSUTIL_3.17.1) is needed by (installed) nss-3.19.1-8.el6_7.i686
 You could try running: rpm -Va --nofiles --nodigest
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx-2016-03-20-17-138MTkm5.yumtx
[root@f9be7c6c1a52 /]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
修改[root@f9be7c6c1a52 /]# vi /etc/ssh/sshd_config 
 
96 #UsePAM no
97 UsePAM no
 
关闭主机selinux
[root@localhost /]# vim /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

Dockerfile 文件格式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[root@localhost dockerfiles]# cat Dockerfile
FROM centos:6 
 
MAINTAINER Key Jia <13164952317@126.com>
 
 
# 单独添加一个文件
ADD files/file1.txt /dir1
ADD files/file2.txt /dir2/
 
# 添加多个文件
# Step 4 : ADD files/* /dir3
# When using ADD with more than one source file, the destination must be a directory and end with a /
# ADD files/* /dir3
 
ADD files/* /dir4/
 
 
# src为文件夹
ADD files /dir5
ADD files /dir6/
ADD files/ /dir7/
 
# 添加URL文件(带文件名)
ADD https://raw.githubusercontent.com/docker/docker/master/Dockerfile /url1
 
ADD https://raw.githubusercontent.com/docker/docker/master/Dockerfile /url2/
 
 
# 添加URL文件(不带文件名)
ADD https://github.com/ /url3
 
# Step 8 : ADD https://github.com/ /url4/
# Downloading 17.63 kB
# cannot determine filename from url: https://github.com/
 
# ADD https://github.com/ /url4/

Docker配置桥接网络

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
安装pipwork
git clone https://github.com/jpetazzo/pipework
 
设置主机为桥接状态
cd /etc/sysconfig/network-scripts/; cp ifcfg-eth0  ifcfg-br0
vi ifcfg-eth0 //增加BRIDGE=br0,删除IPADDR,NETMASK,GATEWAY,DNS1
vi ifcfg-br0//修改DEVICE为br0,Type为Bridge,把eth0的网络设置设置到这里来
 
配置如下:
[root@localhost ~]# ifconfig
docker0   Link encap:Ethernet  HWaddr 32:9F:EC:A9:08:EA  
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::8032:1fff:febc:c437/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:109051 errors:0 dropped:0 overruns:0 frame:0
          TX packets:153465 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5745966 (5.4 MiB)  TX bytes:497759555 (474.7 MiB)
 
eth0      Link encap:Ethernet  HWaddr 00:0C:29:84:63:8C  
          inet addr:192.168.32.120  Bcast:192.168.32.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe84:638c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:597578 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59150 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:275465297 (262.7 MiB)  TX bytes:5089601 (4.8 MiB)
 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:123811 errors:0 dropped:0 overruns:0 frame:0
          TX packets:123811 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:456345433 (435.2 MiB)  TX bytes:456345433 (435.2 MiB)
 
vethb911bc4 Link encap:Ethernet  HWaddr D2:F2:E4:07:80:32  
          inet6 addr: fe80::d0f2:e4ff:fe07:8032/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:979 (979.0 b)  TX bytes:1655 (1.6 KiB)
 
veth03a7489 Link encap:Ethernet  HWaddr 32:9F:EC:A9:08:EA  
          inet6 addr: fe80::309f:ecff:fea9:8ea/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9171 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11304 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:619469 (604.9 KiB)  TX bytes:38522521 (36.7 MiB)
 
veth36c5211 Link encap:Ethernet  HWaddr 3A:4C:A6:F3:99:1B  
          inet6 addr: fe80::384c:a6ff:fef3:991b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:558 (558.0 b)  TX bytes:1746 (1.7 KiB)
 
veth4678dc2 Link encap:Ethernet  HWaddr FE:D3:AA:2F:62:69  
          inet6 addr: fe80::fcd3:aaff:fe2f:6269/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:696 (696.0 b)  TX bytes:3884 (3.7 KiB)
 
vethc1cb675 Link encap:Ethernet  HWaddr 3A:67:6F:60:65:56  
          inet6 addr: fe80::3867:6fff:fe60:6556/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:99814 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142231 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6648110 (6.3 MiB)  TX bytes:459241897 (437.9 MiB)
 
 
拷贝ifcfg-eth0 至ifcfg-br0
[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-br0  
 
配置ifcfg-eth0
 
[root@localhost network-scripts]# cat ifcfg-eth0 
DEVICE=eth0
TYPE=Ethernet
UUID=c3e80ed0-5019-48ba-a4cc-f395d342847c
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:0C:29:84:63:8C
BRIDGE=br0
[root@localhost network-scripts]# 
 
配置ifcfg-br0
[root@localhost network-scripts]# cat ifcfg-br0 
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
HWADDR=00:0C:29:84:63:8C
IPADDR=192.168.32.120
NETMASK=255.255.255.0
GATEWAY=192.168.32.254
[root@localhost network-scripts]# 
 
重启网卡服务
[root@localhost network-scripts]# /etc/init.d/network restart
 
安装pipwork
[root@localhost /]#  git clone https://github.com/jpetazzo/pipework 
 
[root@localhost /]# cp pipework/pipework /usr/local/bin/
 
开启一个容器:
[root@localhost /]# docker run -itd --net=none --name centos-web centos /bin/bash
f9be7c6c1a52dbb65e22766eeabe64f0012e7281212b4f40b84507c5f2de3136
 
升级iproute
 
[root@localhost /]# rpm -Uvh https://repos.fedorapeople.org/openstack/EOL/openstack-grizzly/epel-6/iproute-2.6.32-130.el6ost.netns.2.x86_64.rpm 
Retrieving https://repos.fedorapeople.org/openstack/EOL/openstack-grizzly/epel-6/iproute-2.6.32-130.el6ost.netns.2.x86_64.rpm
warning: /var/tmp/rpm-tmp.2Cha4E: Header V4 RSA/SHA1 Signature, key ID d97b3247: NOKEY
Preparing...                ########################################### [100%]
   1:iproute                ########################################### [100%]
[root@localhost /]# 
 
 
配置网络
[root@localhost /]# pipework br0 f9be7c6c1a52dbb65e22766eeabe64f0012e7281212b4f40b84507c5f2de3136 192.168.32.121/24@192.168.32.254
 
进入容器
[root@localhost /]# docker exec -it f9be /bin/bash
 
查看地址
[root@f9be7c6c1a52 /]# ifconfig
eth1      Link encap:Ethernet  HWaddr C6:FE:5E:40:94:4A  
          inet addr:192.168.32.121  Bcast:192.168.32.255  Mask:255.255.255.0
          inet6 addr: fe80::c4fe:5eff:fe40:944a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:887 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:75567 (73.7 KiB)  TX bytes:510 (510.0 b)
 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
 
[root@f9be7c6c1a52 /]# ping www.baidu.com
PING www.a.shifen.com (115.239.210.27) 56(84) bytes of data.
64 bytes from 115.239.210.27: icmp_seq=1 ttl=57 time=5.46 ms
64 bytes from 115.239.210.27: icmp_seq=2 ttl=57 time=2.73 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1089ms
rtt min/avg/max/mdev = 2.738/4.100/5.462/1.362 ms
[root@f9be7c6c1a52 /]#

本地数据目录data挂载到容器系统中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
创建data目录
[root@localhost ~]# mkdir /data/
 
[root@localhost data]# docker run -itd -v /data/:/data01/ centos bash
d0140fb14f36629e193e0100e39e607ffa4359fb8beb2a07fdbcd747acdad5d1
 
进入d014系统
[root@localhost data]# docker exec  -it d014 bash
 
查看挂载情况:
[root@d0140fb14f36 /]# df -Th
Filesystem           Type    Size  Used Avail Use% Mounted on
rootfs               rootfs  9.8G  360M  8.9G   4% /
/dev/mapper/docker-253:0-525066-d0140fb14f36629e193e0100e39e607ffa4359fb8beb2a07fdbcd747acdad5d1
                     ext4    9.8G  360M  8.9G   4% /
tmpfs                tmpfs   1.9G     0  1.9G   0% /dev
shm                  tmpfs    64M     0   64M   0% /dev/shm
/dev/mapper/VolGroup-lv_root
                     ext4     50G  5.8G   41G  13% /data01
/dev/mapper/VolGroup-lv_root
                     ext4     50G  5.8G   41G  13% /etc/resolv.conf
/dev/mapper/VolGroup-lv_root
                     ext4     50G  5.8G   41G  13% /etc/hostname
/dev/mapper/VolGroup-lv_root
                     ext4     50G  5.8G   41G  13% /etc/hosts
tmpfs                tmpfs   1.9G     0  1.9G   0% /proc/kcore
tmpfs                tmpfs   1.9G     0  1.9G   0% /proc/timer_stats
[root@d0140fb14f36 /]# 
 
进入data01目录创建数据文件
[root@d0140fb14f36 /]# cd /data01/
[root@d0140fb14f36 data01]# ls
[root@d0140fb14f36 data01]# touch a.txt
[root@d0140fb14f36 data01]# touch b.txt
[root@d0140fb14f36 data01]# 
 
查看宿主机data目录文件是否已完成创建:
[root@localhost data]# cd /data/
[root@localhost data]# ls
a.txt  b.txt
[root@localhost data]#