docker部署 mysql redis问题

问题:(ubuntu不报错,centos报错)

ERROR: for ai-mysql  Cannot start service ai-mysql: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/root/deploy_middleware/middleware-volume/mysql.cnf\\\" to rootfs \\\"/var/lib/docker/overlay2/220e5fc7becf3129bd3c8c23208d6dff5ec550700840e573722f3be94a38a0a5/merged\\\" at \\\"/var/lib/docker/overlay2/220e5fc7becf3129bd3c8c23208d6dff5ec550700840e573722f3be94a38a0a5/merged/etc/mysql/conf.d/mysql.cnf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

把挂在路径改成文件夹就可以了

 

报错前:

$PWD/middleware-volume/mysql.cnf:/etc/mysql/conf.d/mysql.cnf

解决方法:

middleware/ 目录下新建一个文件夹conf

1. 进入middleware目录,创建conf文件夹
mkdir conf
2. 进入conf并创建cnf配置文件
cd conf
vim mysql.cnf
3. 挂在路径更改成目录
$PWD/middleware-volume/conf/:/etc/mysql/conf.d

 

redis问题:

envsubst: error while reading "standard input": Is a directory

解决方法同mysql

1. 进入middleware目录,创建template文件夹
mkdir template
2. 进入template并创建template配置文件 
cd template vim redis.template
3. 挂在路径更改成目录
$PWD
/middleware-volume/template/:/usr/local/etc/redis

 

service: application.yml 到底用不用? 如果用这种形式,readme写上 

 

mysql利用sql脚本插入数据中文乱码:

将其中的

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES gbk */;
和末尾的


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
这两部分删除 


再次导入即可成功,最好先将之前导入的废数据清空。

 

 

===============

ssh上传文件:

scp <本地文件名> <用户名>@<ssh服务器地址>:<上传保存路径即文件名>

如果希望将当前目录下的a.txt文件上传到ssh服务器上test文件夹并改名为b.txt,其中ssh服务器网址为127.0.0.1,用户名root。
代码如下:

scp a.txt root@127.0.0.1:/home/neo/test/b.txt

 

 

n2n:

https://blog.csdn.net/likai503819723/article/details/37764807

https://www.right.com.cn/forum/thread-178388-1-1.html

https://blog.csdn.net/papaaa/article/details/77366382

 

 

解压:tar zxvf FileName.tar.tgz
压缩:tar zcvf FileName.tar.tgz FileName
 
posted @ 2019-01-10 00:42  静静别跑  阅读(724)  评论(0编辑  收藏  举报