亚洲城ca88唯一备用服务器上布署利用

  1. 安装Ubuntu
  2. 用Putty登录Ubuntu
    Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-40-generic x86_64)

Docker基本功概念

 * Documentation: 

在采用Docker在此之前,大家先掌握下多少个Docker的着力概念

  System information as of Wed Dec 31 06:41:16 UTC 2014

Docker Daemon

  System load:  0.01              Processes:              228
  Usage of /:  6.0% of 28.80GB  Users logged in:        0
  Memory usage: 11%              IP address for eth0:    10.205.178.22
  Swap usage:  0%                IP address for docker0: 172.17.42.1

Docker引擎,便是运维在后台的三个护理进度,在我们运营它今后,大家就足以透过Docker顾客端发送有关Docker的吩咐。

  Graph this data and manage this system at:
   

Docker Images

  Get cloud support with Ubuntu Advantage Cloud Guest:
   

Docker镜像,这些就好像于我们在安装Windows时的镜像,只可是windows的镜像,在原先大家日常存在光盘上照旧U盘里,这里的镜像我们司空见惯会揭破到Docker
Registry

  1. 拉取redis镜像
    root@jumping:~# sudo docker pull redis:latest
    redis:latest: The image you are pulling has been verified
    eee46bd361c1: Pull complete
    ff8650f588b2: Pull complete
    130985f77ca0: Pull complete
    4d81fff38a25: Pull complete
    e6d98faa32e2: Pull complete
    95d3849978c3: Pull complete
    263f96794544: Pull complete
    1ed9b7611cf5: Pull complete
    451742990a7f: Pull complete
    511136ea3c5a: Already exists
    f10807909bc5: Already exists
    f6fab3b798be: Already exists
    1e6ac0ffed3b: Already exists
    62ff5003ac9a: Already exists
    e49d349e8a75: Already exists
    61213f5a1710: Already exists
    9feca322d1c7: Already exists
    1aa8ce669b93: Already exists
    Status: Downloaded newer image for redis:latest
    root@jumping:~# sudo docker images
    REPOSITORY                TAG                IMAGE ID           
    CREATED            VIRTUAL SIZE
    redis                    latest              451742990a7f        11 days
    ago        111.2 MB

  2. 启动redis容器
    root@jumping:~# sudo docker run -t -i redis:latest
    [1] 31 Dec 02:56:57.870 # Warning: no config file specified, using
    the default config. In order to specify a config file use redis-server
    /path/to/redis.conf
                    _._
              _.-“__ ”-._
          _.-“    `.  `_.  ”-._          Redis 2.8.19 (00000000/0)
    64 bit
      .-“ .-“`.  “`\/    _.,_ ”-._
     (    ‘      ,      .-`  | `,    )    Running in stand alone mode
     |`-._`-…-` __…-.“-._|’` _.-‘|    Port: 6379
     |    `-._  `._    /    _.-‘    |    PID: 1
      `-._    `-._  `-./  _.-‘    _.-‘
     |`-._`-._    `-.__.-‘    _.-‘_.-‘|
     |    `-._`-._亚洲城ca88唯一备用,        _.-‘_.-‘    |         
      `-._    `-._`-.__.-‘_.-‘    _.-‘
     |`-._`-._    `-.__.-‘    _.-‘_.-‘|
     |    `-._`-._        _.-‘_.-‘    |
      `-._    `-._`-.__.-‘_.-‘    _.-‘
          `-._    `-.__.-‘    _.-‘
              `-._        _.-‘
                  `-.__.-‘

Docker Containers

[1] 31 Dec 02:56:57.890 # Server started, Redis version 2.8.19
[1] 31 Dec 02:56:57.890 # WARNING overcommit_memory is set to 0!
Background save may fail under low memory condition. To fix this issue
add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or
run the command ‘sysctl vm.overcommit_memory=1’ for this to take
effect.
[1] 31 Dec 02:56:57.891 # WARNING you have Transparent Huge Pages
(THP) support enabled in your kernel. This will create latency and
memory usage issues with Redis. To fix this issue run the command ‘echo
never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and
add it to your /etc/rc.local in order to retain the setting after a
reboot. Redis must be restarted after THP is disabled.
[1] 31 Dec 02:56:57.891 # WARNING: The TCP backlog setting of 511
cannot be enforced because /proc/sys/net/core/somaxconn is set to the
lower value of 128.
[1] 31 Dec 02:56:57.891 * The server is now ready to accept
connections on port 6379

Docker容器,在收获到Docker镜像之后,大家得以运作该镜像,此时便会运营叁个Docker容器,该容器中运维镜像中的程序。纵然把Docker镜像掌握为二个类的话,那么Docker容器便是三个实例

5.Redis容器运营了,那接下去如何是好?
主意:把putty关了,然后从新步入putty

Docker Client

  1. 怎么进去容器呢?
    先安装NSenter:

Docker客商端,我们设置完Docker之后,大家开发终端应用docker
相关命令进行操作,那个命令正是Docker客户端的命令,其余还应该有一个遵照REST
API的Docker客商端,REST
API平时用于在付出一些基于Docker运转的种类中使用。

cd /tmp; curl

| tar -zxf-; cd util-linux-2.25;
sudo apt-get install build-essential
sudo apt-get make
./configure –without-ncurses
make nsenter && sudo cp nsenter /usr/local/bin

Docker Registry

方法一:

Docker镜像注册中央,Docker的官方网站的登记中央为

PID=$(docker inspect –format “{{ .State.Pid }}” <container>)

以上是Docker的大旨概念,下边我们来看怎么着接收Docker安装Redis、Zookeeper、Mysql,并在经过中,学习运用Docker
Client的有的常用命令

nsenter –target $PID –mount –uts –ipc –net –pid

安装

方法二:

CentOS
yum install docker
systemctl start docker.service
systemctl enable docker.service

安装脚本(脚本参照:

Ubuntu 16.04
sudo apt-get update
sudo apt-key adv –keyserver hkp://p80.pool.sks-keyservers.net:80
–recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository ‘deb
ubuntu-xenial main’
sudo apt-get update
apt-cache policy docker-engine
sudo apt-get install docker-ce
sudo apt-get install -y docker-engine
sudo systemctl status docker

wget -P ~
;

官方源
sudo apt-get install \
 apt-transport-https \
 ca-certificates \
 curl \
 software-properties-commo

echo “[ -f ~/.bashrc_docker ] && . ~/.bashrc_docker” >>
~/.bashrc; source ~/.bashrc

curl -fsSL | sudo apt-key
add –
sudo add-apt-repository \
 “deb [arch=amd64] \
 $(lsb_release -cs) \
 stable”

聊起底,调用docker-enter步入容器:

中央接收

root@jumping:/tmp# docker-enter b430d6f4ff00 ls
dirname: invalid option — ‘s’
Try ‘dirname –help’ for more information.
bin  boot  data  dev  entrypoint.sh  etc  home  lib  lib64  media  mnt 
opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var
root@b430d6f4ff00:~#

ElasticSearch

注:这里大家收看有荒唐,是因为脚本中用到$(dirname “$0″”),
大家能够直接echo “$0″,作者那边突显的是-su

docker pull docker.elastic.co/elasticsearch/elasticsearch:5.4.0
docker run -p 9200:9200 -e “http.host=0.0.0.0” -e
“transport.host=127.0.0.1”
docker.elastic.co/elasticsearch/elasticsearch:5.4.0

  1. 测试redis命令
    进去容器后得以用redis-cli
    ping测试能够连绵不断上本机刚才运营的redis-server不,重返PONG表明连接成功。

安装 head 插件(es 5.x)

直接按redis-cli步向redis 命令测量检验下能够用不:

docker run -p 9100:9100 mobz/elasticsearch-head:5

root@816ebd247014:~# redis-cli ping
PONG
root@816ebd247014:~# redis-cli
127.0.0.1:6379> set myname jumping
OK
127.0.0.1:6379> get myname
“jumping”
127.0.0.1:6379>

Redis

8.
这么就归纳的把redis运行起来了,要用起来我们还要把端口影射到宿主机器上,然后可以经过客商带给调用Redis:

查找镜像

Ubuntu
14.04下Redis安装及轻巧测验

http://www.linuxidc.com/Linux/2014-05/101544.htm

运用以下命令在Docker Hub寻觅Redis镜像

Redis集群明细文书档案
http://www.linuxidc.com/Linux/2013-09/90118.htm

docker search redis

Ubuntu 12.10下安装Redis(图像和文字详整卡塔尔国+ Jedis连接Redis
http://www.linuxidc.com/Linux/2013-06/85816.htm

拉取镜像

Redis类别-安装配备维护篇
http://www.linuxidc.com/Linux/2012-12/75627.htm

docker pull redis:latest

CentOS 6.3安装Redis
http://www.linuxidc.com/Linux/2012-12/75314.htm

列出装有镜像

Redis安装配备学习笔记
http://www.linuxidc.com/Linux/2014-07/104306.htm

docker images

Redis配置文件redis.conf 详明
http://www.linuxidc.com/Linux/2013-11/92524.htm

创立并运行容器

Redis
的事必躬亲介绍
:请点这里
Redis
的下载地址
:请点这里

docker run -p 6379:6379 -v $PWD/data:/data  -d redis:latest redis-server
–appendonly yes

越来越多Ubuntu相关音讯见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2

奉行以上命令,大家就使用redis:latest镜像创造并运转了一个Redis容器,个中

本文永恒更新链接地址:http://www.linuxidc.com/Linux/2015-01/111180.htm

-p 6379:6379:将容器的6379端口映射成主机的6379端口

亚洲城ca88唯一备用 1

-v $PWD/data:/data :将主机中当前目录下的data挂载到容器的/data

redis-server –appendonly yes :
在容器实行redis-server运转命令,并开发redis悠久化配置

查阅容器

docker ps

连接redis容器

动用Redis镜像使用redis-cli顾客端,连选拔redis容器

docker run -it redis:latest redis-cli -h 192.168.0.101

Zookeeper

接下去大家设置zookeeper,大家选择和redis雷同的法门。直接动用最少的步骤安装,不再做过多解释

查找zookeeper镜像

docker search zookeeper

拉取镜像

docker pull zookeeper

创制并运营容器

docker run -p 2181:2181 -v $PWD/data:/data  -d zookeeper:latest

运用zookeeprt镜像成立并运维容器,我们把容器的2181映射到机械的2181上,一样把当前目录的data
挂载到容器的/data

查看当前容器列表

docker ps

越多Docker相关教程见以下内容

Docker安装应用(CentOS 6.5_x64)
http://www.linuxidc.com/Linux/2014-07/104595.htm

Ubuntu 14.04安装Docker 
http://www.linuxidc.com/linux/2014-08/105656.htm

Ubuntu 15.04下安装Docker 
http://www.linuxidc.com/Linux/2015-07/120444.htm

Docker 安装实例
http://www.linuxidc.com/Linux/2017-04/142666.htm

Docker 成立底子镜像 
http://www.linuxidc.com/Linux/2017-05/144112.htm

在 Ubuntu 15.04 上怎么样设置Docker及大旨用法
http://www.linuxidc.com/Linux/2015-09/122885.htm

Ubuntu 16.04上Docker使用手记
http://www.linuxidc.com/Linux/2016-12/138490.htm

应用Docker分分钟开行常用应用 
http://www.linuxidc.com/Linux/2017-04/142649.htm

Ubuntu 16.04下Docker改革配置文件不看到效果解决办法 
http://www.linuxidc.com/Linux/2017-05/143862.htm 

Docker
的详实介绍
:请点这里
Docker
的下载地址
:请点这里

本文永恒更新链接地址:http://www.linuxidc.com/Linux/2017-06/145176.htm

亚洲城ca88唯一备用 2

相关文章