I'm currently testing minikube (v0.18.0) with MongoDB and I want to share directory between MongoDB (/data/db
) and my local host (Mac).
I ran
$ mkdir /Users/minikube/mongodb
$ minikube start --vm-driver=xhyve
$ minikube mount /Users/minikube/
Then create a MongoDB pod like
apiVersion: 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
The directory is mounted, but I saw the error,
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
and I could not start MongoDB.
If I change the mount point other than /Users/
like tmp/
, then
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
A permission error occurs and I could not even mount.
Also, if I stop mounting and use just a directory inside VM, it looks working.
It looks there is some file system issue when I use VirtualBox driver, but I could not get enough information about xhyve...does anyone successfully using MongoDB with minikube while mounting a directory on host (not VM) ?
I tried this scenario using kvm
as vm-driver, it seems to be working perfectly for me. See, In your first logs, it says,
2017-04-09T19:53:52.156+0000 E JOURNAL [initandlisten] Insufficient free space for journal files
, might be folder you are mounting might not have enough space.
Specifically check permissions of folder on host, it should be 775