docker学习笔记及hadoop集群搭建

docker的基本概念:

  • 镜像(image):
  • 容器(container):
  • 仓库:

问题点:

0、C#码农的大数据之路 - 使用Ambari自动化安装HDP2.6(基于Ubuntu16.04)并运行.NET Core编写的MR作业

  https://www.cnblogs.com/lsxqw2004/p/6908593.html

  https://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari/index.html

1、不同物理节点上的docker容器如何互通?

https://www.cnblogs.com/yy-cxd/p/6553624.html

https://www.cnblogs.com/CloudMan6/p/7087765.html

 http://blog.51cto.com/wzlinux/2112061

2、宿主机重启后container如何恢复? 

使用在Docker run的时候使用--restart参数来设置。参考链接

no - container:不重启

on-failure - container:退出状态非0时重启

always:始终重启

3、https://blog.csdn.net/lgq2626/article/details/78900835 : docker容器IP不固定问题

4、docker network create:https://blog.csdn.net/gezhonglei2007/article/details/51627821

  相关知识:https://blog.csdn.net/gatieme/article/details/50989257、https://www.cnblogs.com/CloudMan6/p/5716947.html

5、apt-get update和upgrade的区别:https://blog.csdn.net/beckeyloveyou/article/details/51352426

6、build报错:https://github.com/u39kun/ambari-vagrant/pull/9 

  https://www.cnblogs.com/gordonchang/p/6675007.html#009

  apt-get install make -y

  apt-get install g++ -y

  apt-get install git -y

  apt-get install python-dev

7、maven安装:https://blog.csdn.net/ac_dao_di/article/details/54233520

8、postgres安装:https://blog.csdn.net/zj0078/article/details/71156064

  https://blog.csdn.net/levy_cui/article/details/51578228

  

  service postgresql restart

  

9、privileged参数:https://blog.csdn.net/halcyonbaby/article/details/43499409

10、ssh安装:https://blog.csdn.net/cs_mary/article/details/54728906、https://blog.csdn.net/jackghq/article/details/54974141

  ssh-server配置文件位于/etc/ssh/sshd_config,在这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号,如222

  (或把配置文件中的”PermitRootLogin without-password”加一个”#”号,把它注释掉,再增加一句”PermitRootLogin yes”) 

11、端口映射、docker network:https://blog.csdn.net/gezhonglei2007/article/details/51627821、https://www.jianshu.com/p/2b424c3bf0f7

12、dockerfile:http://www.docker.org.cn/dockerppt/114.html、https://blog.csdn.net/e421083458/article/details/52512164

13、docker目录挂载:https://www.cnblogs.com/soar1688/p/6833540.html

  https://www.cnblogs.com/ivictor/p/4834864.html

14、修改端口映射:https://blog.csdn.net/wesleyflagon/article/details/78961990

15、修改ambari端口号:

  Ambari 使用 8080 端口提供服务,这个端口很多情况下会被 tomcat 等其他应用所占用。修改的方法如下:

  修改配置文件 /etc/ambari-server/conf/ambari.properties

  client.api.port=<port_number>

  默认情况下配置文件中没有这个选项,添加上就可以。

16、Ambari——大数据平台的搭建利器:https://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari/index.html

  https://zhuanlan.zhihu.com/p/30830146 

  https://www.linuxidc.com/Linux/2017-10/147487.htm

17、docker制作镜像 apt-get 安装文件报错debconf: unable to initialize frontend: Dialog

  

 18、Linux下实现软件的静默安装 debconf:https://blog.csdn.net/fickyou/article/details/50960444

 19、docker常用命令及一些坑:https://blog.csdn.net/wsscy2004/article/details/25878363

20、使用Dockerfile构建docker镜像:https://blog.csdn.net/rznice/article/details/52211620

21、Automated Install with Ambari:https://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_Installing_HDP_AMB/content/_database_requirements.html

22、在ubuntu14.04上使用ambari搭建hadoop集群:https://blog.csdn.net/zcc_heu/article/details/53543558 

23、try 'dpkg-reconfigure debconf' to select a frontend other than noninteractive:

    echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections

    echo debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections

  https://dzone.com/articles/puppet-installing-oracle-java

  https://shazi.info/ubuntu-16-04-%E5%AE%89%E8%A3%9D-tomcat8-oracle-java8-%E5%92%8C-oracle-license-%E7%9A%84%E5%95%8F%E9%A1%8C/

24、重启ntp服务:sudo /etc/init.d/ntp restart

  https://blog.csdn.net/DavyLee2008/article/details/66973851 

 25、防火墙ufw

  https://www.cnblogs.com/EasonJim/p/6851241.html

26、bash: sercice: command not found

  yum install initscripts.x86_64

  http://jingsan0801.farbox.com/post/docker/docker-wen-ti-hui-zong?action=show_raw

27、hostname

  vi /etc/sysconfig/network

    NETWORKING=yes

    HOSTNAME=ambari_0.apache.org

  vi /etc/hostname

    ambari_0.apache.org

  vi /etc/hosts

127.0.0.1 ambari_0.apache.org
#::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.25.0.3 ambari_1.apache.org
172.25.0.4 ambari_2.apache.org
172.25.0.2 ambari_0.apache.org

28、软件卸载 

  rpm -qa | grep postgres    检查PostgreSQL 是否已经安装
  rpm -qal | grep postgres 检查PostgreSQL 安装位置
  rpm -e 应用

  https://www.cnblogs.com/qiyebao/p/4562557.html   

29、修改hostname

  hostnamectl set-hostname centos7

  https://blog.csdn.net/qq_37187976/article/details/79096742 

30、Docker容器学习梳理-容器时间跟宿主机时间同步

  https://www.cnblogs.com/kevingrace/p/5570597.html

31、mysql连接失败:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

  https://blog.csdn.net/strongyoung88/article/details/52081058 

linux 命令中init的值改成3(推荐)
另附
# 0 - 停机(千万不能把initdefault 设置为0 )
# 1 - 单用户模式
# 2 - 多用户,没有 NFS
# 3 - 完全多用户模式(标准的运行级)
# 4 - 没有用到
# 5 - X11 (xwindow)
# 6 - 重新启动 (千万不要把initdefault 设置为6 )

Linux中重启的两个命令:reboot和init 6之间的区别

init命令用于改变操作系统的运行级别。
Init 6是重新启动机器。
reboot也是重新启动机器。
那么这两个命令到底有什么区别呢?
对这两个操作使用man命令看到的内容如下:
"init 6" 基于一系列/etc/inittab文件,并且每个应用都会有一个相应shutdown脚本。
'init 6' 调用一系列shutdown脚本(/etc/rc0.d/K*)来使系统优雅关机;
'reboot'并不执行这些过程,reboot更是一个kernel级别的命令,不对应用使用shutdown脚本。 .
我们应该在通常情况下使用 init 6.
reboot - reboot performs a sync(1M) operation on the disks, and then a
multi- user reboot is initiated. See init(1M) for details.
init 6 Stop the operating system and reboot to the
state defined by the initdefault entry in
/etc/inittab.
在出问题的状况下或强制重启时使用reboot.

使用Docker在本地搭建Hadoop分布式集群

参考文档:https://www.cnblogs.com/onetwo/p/6419925.html

启动docker服务:
  service docker start 或 systemctl start docker
关闭docker服务:
  service docker stop 或 systemctl stop docker

命令解读 docker run -t -i ubuntu /bin/bash
    docker run: runs a container.
    ubuntu: is the image you would like to run.
    -t: flag assigns a pseudo-tty or terminal inside the new container.
    -i: flag allows you to make an interactive connection by grabbing the standard in (STDIN) of the container.
    /bin/bash: launches a Bash shell inside our container.

  显示root@af8bae53bdd3:/# 说明成功启动并进入container了,@后的一串字符“af8bae53bdd3”是containerId
运行中的container:
    docker ps

查看所有container,包括运行中的以及未运行的
    docker ps -a
退出容器:
    Ctrl-D 或 root@af8bae53bdd3:/# exit
启动docker某个image的某个container:
    docker start goofy_almeida    goofy_almeida为container的名字
进入docker命令:
    docker attach goofy_almeida

使用“docker attach”命令进入container(容器)有一个缺点,那就是每次从container中退出到前台时,container也跟着退出了。

要想退出container时,让container仍然在后台运行着,可以使用“docker exec -it”命令。每次使用这个命令进入container,当退出container后,container仍然在后台运行,命令使用方法如下:
    docker exec -it goofy_almeida /bin/bash
这样输入“exit”或者按键“Ctrl + C”退出container时,这个container仍然在后台运行,可通过docker ps查看container是否运行

docker启动容器命令:
  docker run -ti ubuntu
安装ping命令:
  apt-get update 
  apt-get install iputils-ping
java安装:
    apt-get install software-properties-common python-software-properties
    add-apt-repository ppa:webupd8team/java
    apt-get update
    apt-get install oracle-java7-installer
查看java版本:java -version

apt-get install software-properties-common python-software-properties
software-properties-common:
    manage the repositories that you install software from (common)
    This software provides an abstraction of the used apt repositories.
    It allows you to easily manage your distribution and independent software
vendor software sources.
    This package contains the common files for software-properties like the
D-Bus backend.

python-software-properties:
    python3-software-properties: manage the repositories that you install software from

安装vi命令:apt-get install vim
vi显示行号::set number
vi删除多行:

  法一:
  单行删除,:1(待删除行)d
  多行删除 ,:1,10d
  法二:
  光标所在行,dd
  光标所在行以下的N行,Ndd


查询ubuntu版本:cat /etc/issue

  

原文地址:https://www.cnblogs.com/suinlove/p/9153351.html