分类 运维 下的文章

一 安装docker
yum install docker
yum install docker-compose

二 启动
systemctl restart docker

三 下载git上的配置文件
cd /home/www
mkdir rap
cd rap
wget https://raw.githubusercontent.com/thx/rap2-delos/master/docker-compose.yml

四 拉取镜像并启动
docker-compose up -d

五 初始化数据库
docker-compose exec delos node scripts/init

六 更改端口
根据备注修改端口
vim docker-compose.yml
重启
docker-compose down
docker-compose up -d

七 备份及恢复(配置 mysql为例)
查看镜像名和镜像ID
docker ps
容器保存为镜像
docker commit -p docker commit -p rap_mysql_1 rap_mysql_1
docker images
镜像保存到本地
docker save -o rap_mysql_1.tar rap_mysql_1
加载本地镜像
docker load -i rap_mysql_1.tar
重启
docker restart rap_mysql_1

八 数据备份及恢复
查看镜像名和镜像ID
备份
docker ps
docker exec -it 601d3faf9e5e mysqldump -u root rap2 > /home/www/bak.sql
拷贝文件到docker的容器内
docker cp /home/www/bak.sql 601d3faf9e5e:/bak.sql
恢复
docker exec -it 601d3faf9e5e bash
mysql -u root
use rap2
source /bak.sql
docker restart rap_mysql_1

九 修改初始密码
docker exec -it 601d3faf9e5e bash
mysql -u root
use rap2
show tables;
select * from Users;
update Users set password = '14e1b600b1fd579f47433b88e8d85291' where fullname = 'admin';
update Users set password = '14e1b600b1fd579f47433b88e8d85291' where id = '100000001';
flush privileges;
exit;

rap2部署及操作文档.txt

本地文件夹备份至FTP
1 设置ftp及目录信息
2 生成文件夹列表
3 逐一mkdir并mput

批处理如下:

@echo on
rem 设置FTP服务器地址
set ftpIP=192.168.2.247
rem 设置FTP用户名
set ftpUser=wisq
rem 设置FTP密码
set ftpPass=wisq
rem 设置待上传的本地文件夹目录
set UpFolder=D:\test\
rem 设置FTP子文件夹
set ftpFolder=\aishequ

rem 生成待上传的本地文件夹列表
type nul>%temp%\FolderList.txt
for /r "%UpFolder%" %%a in (.) do (
    set FullName=%%a
    setlocal enabledelayedexpansion
    set FolderName=!FullName:%UpFolder%=!
    set FolderName=!FolderName:~0,-2!
    echo,!FolderName!>>%temp%\FolderList.txt
    endlocal
)
>"%temp%\ftpFile.txt" echo,%ftpUser%
>>"%temp%\ftpFile.txt" echo,%ftpPass%
>>"%temp%\ftpFile.txt" echo bin
>>"%temp%\ftpFile.txt" (
    for /f "usebackq tokens=*" %%a in ("%temp%\FolderList.txt") do (
        echo cd \
        echo mkdir "%ftpFolder%\%%a"
        echo cd "%ftpFolder%\%%a"
        echo mput "%UpFolder%\%%a\*"
    )
)
>>"%temp%\ftpFile.txt" echo ! md "%UpFolder%"
>>"%temp%\ftpFile.txt" echo bye
ftp -v -i -s:"%temp%\ftpFile.txt" %ftpIP%

PAUSE

backup2ftp.txt

  1. 更改主机名,写/etc/hosts记录

vim /etc/hosts
47.99.116.202 test.com
0.0.0.0 test.com

关闭防火墙
systemctl disable firewalld

关闭selinux
vim /etc/selinux/config
SELINUX=disabled

  1. 在DNS服务器上安装bind软件

yum -y install bind

  1. 启动DNS服务

systemctl restart named.service
systemctl enable named.service
netstat -anlp | grep named

  1. 域名服务器的配置

修改DNS服务的配置文件
vim /etc/named.conf

options {
        listen-on port 53 { localhost; };    # 将127.0.0.1改为本机IP
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { any; };               # 将localhost改为any,表示所有人都能对我的DNS服务进行查询

添加域的信息写在子配置文件
vim /etc/named.rfc1912.zones

zone "test.com" IN {
        type master;
        file "data/test.com.zone";
};

编辑正向解析文件
vim /var/named/data/test.com.zone

$TTL 1D
@       IN SOA  dns.test.com. dns.www.test.com. (
                                         20171224      ; serial 
                                         1D      ; refresh 
                                         1H      ; retry 
                                         1W      ; expire 
                                         3H )    ; minimum 
@                       IN      NS      dns.test.com.
dns.test.com.           IN      A       58.48.186.194
@                       IN      MX 10   mail.www.test.com.
mail.www.test.com.      IN      A       58.48.186.194
www.test.com.           IN      A       58.48.186.194
ftp.test.com.           IN      A       58.48.186.194

重启
systemctl restart named.service

DNS服务器搭建.txt