Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Shell Script ~/.bash_profile

Olá, eu tenho uma dúvida em relação á configuração do mongodb. Eu uso o Xubuntu 16.04.

Para configurar o PATH, escrevi assim:

nano ~/.bash_profile
export PATH=$PATH:/home/camilabd/Documentos/mongodbcamila/mongolinux/bin

Depois entrei na pasta bin

camilabd@camilabd-Inspiron-5420:~/Documentos/mongodbcamila/mongolinux/bin$    ./mongod --dbpath /home/camilabd/Documentos/mongodbcamila/mongolinux/data/db

Saiu assim:

2017-01-22T11:20:32.121-0200 I CONTROL  [initandlisten] MongoDB starting : pid=3803 port=27017 dbpath=/home/camilabd/Documentos/mongodbcamila/mongolinux/data/db 64-bit host=camilabd-Inspiron-5420
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] db version v3.4.1
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] allocator: tcmalloc
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] modules: none
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] build environment:
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten]     target_arch: x86_64
2017-01-22T11:20:32.122-0200 I CONTROL  [initandlisten] options: { storage: { dbPath: "/home/camilabd/Documentos/mongodbcamila/mongolinux/data/db" } }
2017-01-22T11:20:32.165-0200 I -        [initandlisten] Detected data files in /home/camilabd/Documentos/mongodbcamila/mongolinux/data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-01-22T11:20:32.165-0200 I STORAGE  [initandlisten] 
2017-01-22T11:20:32.165-0200 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-01-22T11:20:32.165-0200 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-01-22T11:20:32.165-0200 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=2406M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-01-22T11:20:33.039-0200 I CONTROL  [initandlisten] 
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] 
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] 
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] 
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-01-22T11:20:33.040-0200 I CONTROL  [initandlisten] 
2017-01-22T11:20:33.045-0200 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/home/camilabd/Documentos/mongodbcamila/mongolinux/data/db/diagnostic.data'
2017-01-22T11:20:33.046-0200 I NETWORK  [thread1] waiting for connections on port 27017

E depois coloquei: (outro terminal)

./mongod
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] MongoDB starting : pid=4474 port=27017 dbpath=/data/db 64-bit host=camilabd-Inspiron-5420
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] db version v3.4.1
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] allocator: tcmalloc
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] modules: none
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten] build environment:
2017-01-22T11:48:57.188-0200 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-01-22T11:48:57.189-0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-01-22T11:48:57.189-0200 I CONTROL  [initandlisten]     target_arch: x86_64
2017-01-22T11:48:57.189-0200 I CONTROL  [initandlisten] options: {}
2017-01-22T11:48:57.189-0200 I STORAGE  [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating
2017-01-22T11:48:57.189-0200 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2017-01-22T11:48:57.189-0200 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2017-01-22T11:48:57.189-0200 I CONTROL  [initandlisten] now exiting
2017-01-22T11:48:57.189-0200 I CONTROL  [initandlisten] shutting down with code:100

Lembrando que eu já tenho as pastas criadas dentro da pasta 'data/db'

Alguém está disposto a me ajudar? xD

2 respostas
solução!

Olá Camila, tudo bem?

Não conheço muito de mongodb mas, pelo que eu entendi quando você executa o deamon do mongoatravés do comando ./mongod. Sem passar nenhum parâmetro ele usa configurações padrões. E com isso ele procura o diretório /data a partir da raiz (/).

Uma forma de solucionar isso seria criando um alias que encapsule todos os parâmetros.

Por exemplo:

alias mongo.start = `./mongod --dbpath /home/camilabd/Documentos/mongodbcamila/mongolinux/data/db
`

Isso criará um apelo mongo.start para o comando completo que é ./mongod --dbpath /home/camilabd/Documentos/mongodbcamila/mongolinux/data/db

Se você quiser, pode fazer isso no seu bash_profile. Dessa forma você pode executar mongo.start para rodar o mongodb.

Espero ter ajudado!

Oi Fernando! Puxa! Agora notei que este fórum estava inativo.

Então, obrigada pela resposta. Portanto, eu alterei o sistema operacional, então instalei no Windows 10.

Obrigada !