我目前正在使用MongoDB测试minikube(v0.18.0),我希望在MongoDB(/data/db
)和我的本地主机(Mac)之间共享目录。
我跑了
$ mkdir /Users/minikube/mongodb
$ minikube start --vm-driver=xhyve
$ minikube mount /Users/minikube/
然后创建一个像
一样的MongoDB podapiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mongodb
spec:
replicas: 1
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo:3.0.14
imagePullPolicy: IfNotPresent
ports:
- containerPort: 27017
volumeMounts:
- mountPath: /data/db
name: datadir
command: ["mongod"]
args:
- '--smallfiles'
volumes:
- name: datadir
hostPath:
path: /mount-9p/mongodb
目录已挂载,但我看到了错误
2017-04-09T19:53:52.082+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=mongodb-2548301107-vs9hq
2017-04-09T19:53:52.082+0000 I CONTROL [initandlisten] db version v3.0.14
2017-04-09T19:53:52.082+0000 I CONTROL [initandlisten] git version: 08352afcca24bfc145240a0fac9d28b978ab77f3
2017-04-09T19:53:52.085+0000 I CONTROL [initandlisten] build info: Linux ip-10-30-223-232 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 BOOST_LIB_VERSION=1_49
2017-04-09T19:53:52.085+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-04-09T19:53:52.085+0000 I CONTROL [initandlisten] options: { storage: { mmapv1: { smallFiles: true } } }
2017-04-09T19:53:52.144+0000 I JOURNAL [initandlisten] journal dir=/data/db/journal
2017-04-09T19:53:52.149+0000 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2017-04-09T19:53:52.156+0000 I JOURNAL [initandlisten]
2017-04-09T19:53:52.156+0000 E JOURNAL [initandlisten] Insufficient free space for journal files
2017-04-09T19:53:52.157+0000 I JOURNAL [initandlisten] Please make at least 422MB available in /data/db/journal or use --smallfiles
2017-04-09T19:53:52.157+0000 I JOURNAL [initandlisten]
2017-04-09T19:53:52.157+0000 I STORAGE [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2017-04-09T19:53:52.157+0000 I CONTROL [initandlisten] now exiting
2017-04-09T19:53:52.157+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-04-09T19:53:52.157+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-04-09T19:53:52.157+0000 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-04-09T19:53:52.157+0000 I NETWORK [initandlisten] shutdown: going to close sockets...
2017-04-09T19:53:52.157+0000 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2017-04-09T19:53:52.157+0000 I STORAGE [initandlisten] shutdown: final commit...
2017-04-09T19:53:52.157+0000 I STORAGE [initandlisten] shutdown: closing all files...
2017-04-09T19:53:52.157+0000 I STORAGE [initandlisten] closeAllFiles() finished
2017-04-09T19:53:52.158+0000 I CONTROL [initandlisten] dbexit: rc: 100
我无法启动MongoDB。
如果我更改/Users/
之外的挂载点,例如tmp/
,那么
Mounting /k8s-mount/ into /mount-9p on the minikubeVM
This daemon process needs to stay alive for the mount to still be accessible...
ufs starting
Something went wrong running an SSH command!
command :
sudo mkdir /mount-9p;
sudo mount -t 9p -o trans=tcp -o port=5640 -o uid=1001 -o gid=1001 192.168.64.1 /mount-9p;
sudo chmod 775 /mount-9p;
err : exit status 1
output : chmod: changing permissions of '/mount-9p': Unknown error 526
发生权限错误,我甚至无法安装。
另外,如果我停止安装并仅使用VM内的目录,它看起来有效。
当我使用VirtualBox驱动程序时,看起来存在一些文件系统问题,但我无法获得有关xhyve的足够信息...是否有人在主机(而非VM)上安装目录时成功使用MongoDB和minikube?
答案 0 :(得分:-1)
我使用kvm
作为vm-driver尝试了这种情况,它似乎对我来说非常合适。
请参阅,在您的第一个日志中,它说,
2017-04-09T19:53:52.156+0000 E JOURNAL [initandlisten] Insufficient free space for journal files
,可能是您正在安装的文件夹可能没有足够的空间。
具体检查主机上文件夹的权限,应为775