termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.95k stars 2.98k forks source link

Package Request: MongoDB #249

Closed angrykoala closed 1 year ago

angrykoala commented 8 years ago

Mongo database for nodejs application deploy

fmsouza commented 8 years ago

πŸ‘

BeanLiu76 commented 8 years ago

:+1:

fmsouza commented 8 years ago

Just saw in the official repository that both Ubuntu and Debian are currently supporting MongoDB package for armhf architecture.

Debian: https://packages.debian.org/jessie/mongodb Ubuntu: http://packages.ubuntu.com/xenial/mongodb

piscopoc commented 7 years ago

Any movement on getting this into termux? Has anyone found a way to get MongoDB installed?

vishalbiswas commented 7 years ago

Better C++ support is required. Waiting for next NDK release.

T-vK commented 7 years ago

@vishalbiswas Is C++ support better now? Is the 'next NDK release' there yet? I mean, there was a version bump, right?

its-pointless commented 7 years ago

Should be. we are using libc++ now. Some of us are working on fixing bugs its caused right now on arm (ndk guys said it wasn't stable) . But yeah this might work now.

vishalbiswas commented 7 years ago

MongoDB depends on WiredTiger which only works on 64-bit devices. I don't have one to test. So, it could be possible to port MongoDB, but, not by me.

T-vK commented 7 years ago

I think most of us would be much more interested in a 32-bit version. I mean 64-bit arm devices are very rare, aren't they? I think before version 3.4 MongoDB did run on 32-bit devices, at least on the desktop. Maybe we could simply use an older version? 3.2 for instance is still being maintained.

vishalbiswas commented 7 years ago

@T-vK that's what I'm working on. I have disabled wiredtiger (which is the default engine)

vishalbiswas commented 7 years ago

MongoDB requires some on device configuration data. If you have abundant free space on your device then you can help. Run this on your device/termux.

git clone --depth 1 https://github.com/mongodb/mongo
cd mongo/src/third_party/mozjs-45
sh get-sources.sh
sh gen-config.sh <your arch> android

After successful configuration, you'll have a folder in platform/\<your arch>/android. I need that folder. Ideally, config files for all arches (arm, i686, aarch64 and x86_64) are required for building on that arch

T-vK commented 7 years ago

@vishalbiswas I'm stuck at the gen-config.sh script. I ran sh gen-config.sh arm android and got:

gen-config.sh: 15: gen-config.sh: ./configure: not found
cp: cannot stat 'mozilla-release/js/src/js/src/js-confdefs.h': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/*.cpp': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/js-config.h': No such file or directory
ls: cannot access 'platform/arm/android/build/*.cpp': No such file or directory

I checked the script at line 15 and it says:

PYTHON=python ./configure --without-intl-api --enable-posix-nspr-emulation --disable-trace-logging

right before that it does:

cd mozilla-release/js/src

So I manually checked for the existence of mozilla-release/js/src/configure and sure enough, it does exist. mozilla-release/js/src/js on the other hand does not exist.

vishalbiswas commented 7 years ago

@T-vK run termux-fix-shebang on configure then, and also export CONFIG_SHELL=sh

T-vK commented 7 years ago

@vishalbiswas

Now it says:

Using Python from environment variable $PYTHON
Creating Python environment
./configure: 4708: ./configure: python: not found

It previously complained about me having python 3, so I uninstalled python 3 and now I only have python2. The $PYTHON variable is empty. I tried to set it to the path of the python2 binary, but that didn't help.

Here is the full output:

$ sh gen-config.sh arm android
loading cache ./config.cache
checking host system type... armv7l-unknown-linux-gnueabi
checking target system type... armv7l-unknown-linux-gnueabi
checking build system type... armv7l-unknown-linux-gnueabi
checking for gawk... gawk
checking for perl5... no
checking for perl... /data/data/com.termux/files/usr/bin/perl
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for c++... c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes
checking for ranlib... ranlib
checking for as... /data/data/com.termux/files/usr/bin/as
checking for ar... ar
checking for ld... ld
checking for strip... strip
checking for windres... no
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... c++ -E
checking for rustc... no
checking for sb-conf... no
checking for ve... no
checking for a BSD compatible install... /data/data/com.termux/files/usr/bin/install -c
checking whether ln -s works... yes
checking for tar archiver... checking for gnutar... no
checking for gtar... no
checking for tar... tar
tar
checking for minimum required perl version >= 5.006... 5.024001
checking for full perl installation... yes
Using Python from environment variable $PYTHON
Creating Python environment
./configure: 4708: ./configure: python: not found
------ config.log ------
exit (42);
^
configure:3278:1: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:3301: checking for ranlib
configure:3333: checking for as
configure:3387: checking for ar
configure:3422: checking for ld
configure:3457: checking for strip
configure:3492: checking for windres
configure:3782: checking how to run the C preprocessor
configure:3803: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:3862: checking how to run the C++ preprocessor
configure:3880: c++ -E  conftest.C >/dev/null 2>conftest.out
configure:3908: checking for rustc
configure:4408: checking for sb-conf
configure:4408: checking for ve
configure:4470: checking for a BSD compatible install
configure:4523: checking whether ln -s works
configure:4545: checking for tar archiver
configure:4551: checking for gnutar
configure:4551: checking for gtar
configure:4551: checking for tar
configure:4588: checking for minimum required perl version >= 5.006
configure:4598: checking for full perl installation
cp: cannot stat 'mozilla-release/js/src/js/src/js-confdefs.h': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/*.cpp': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/js-config.h': No such file or directory
ls: cannot access 'platform/arm/android/build/*.cpp': No such file or directory
$

Edit:

I now created a symbolic link called python that points to python2: ln -s /data/data/com.termux/files/usr/bin/python2 /data/data/com.termux/files/usr/bin/python.

Now it doesn't complain about python being missing anymore. But now it complaints:

Exception: Could not detect environment shell!
configure: error: Python environment does not appear to be sane.
Using Python from environment variable $PYTHON
Creating Python environment
checking Python environment is Mozilla virtualenv... Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/build/mach_bootstrap.py", line 340, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/python/mozbuild/mozbuild/base.py", line 17, in <module>
    from mach.mixin.process import ProcessExecutionMixin
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/build/mach_bootstrap.py", line 340, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/data/data/com.termux/files/home/mongo/src/third_party/mozjs-45/mozilla-release/python/mach/mach/mixin/process.py", line 29, in <module>
    raise Exception('Could not detect environment shell!')
Exception: Could not detect environment shell!
configure: error: Python environment does not appear to be sane.
------ config.log ------
configure:3278:1: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:3301: checking for ranlib
configure:3333: checking for as
configure:3387: checking for ar
configure:3422: checking for ld
configure:3457: checking for strip
configure:3492: checking for windres
configure:3782: checking how to run the C preprocessor
configure:3803: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:3862: checking how to run the C++ preprocessor
configure:3880: c++ -E  conftest.C >/dev/null 2>conftest.out
configure:3908: checking for rustc
configure:4408: checking for sb-conf
configure:4408: checking for ve
configure:4470: checking for a BSD compatible install
configure:4523: checking whether ln -s works
configure:4545: checking for tar archiver
configure:4551: checking for gnutar
configure:4551: checking for gtar
configure:4551: checking for tar
configure:4588: checking for minimum required perl version >= 5.006
configure:4598: checking for full perl installation
configure:4726: checking Python environment is Mozilla virtualenv
configure: error: Python environment does not appear to be sane.
cp: cannot stat 'mozilla-release/js/src/js/src/js-confdefs.h': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/*.cpp': No such file or directory
cp: cannot stat 'mozilla-release/js/src/js/src/js-config.h': No such file or directory
ls: cannot access 'platform/arm/android/build/*.cpp': No such file or directory
vishalbiswas commented 7 years ago

Let it be. I've also disabled mozjs engine. I did manage it on my arm device but with different steps. If its really wanted, I'll request it again here.

T-vK commented 7 years ago

Okay, if there is anything else that I can do, tell me.

vishalbiswas commented 7 years ago

Edit: Do not try these yet. Let me do this on my arm mobile and build successfully

seems like mongo shell cannot be built without mozjs and with the shell, mongodb itself wouldn't be as useful. So if you are still up to it, follow these steps:

  1. Download moz.txt. Install proot, python2, clang if not already installed.
  2. Run it with sh moz.txt <your arch>. \<your arch> should be one of arm, aarch64 and i686 and x86_64.
  3. If it's successful, you'll get a file named platform_\<your arch>.patch. Upload that patch here.

It shouldn't use as much space as downloading the whole firefox code like before

vishalbiswas commented 7 years ago

Updates: Doesn't work, yet.

Successfully compiled and install on arm device, but the server fails to start.

2017-08-08T14:00:46.067+0530 I CONTROL  [main] 
2017-08-08T14:00:46.067+0530 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2017-08-08T14:00:46.068+0530 I CONTROL  [main] 
[New LWP 19651]
[New LWP 19652]
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] MongoDB starting : pid=19635 port=27017 dbpath=/storage/sdcard0/db 32-bit host=localhost
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] db version v3.4.6
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-08-08T14:00:46.096+0530 I CONTROL  [initandlisten] allocator: system
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten] modules: none
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten] build environment:
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten]     distarch: arm
2017-08-08T14:00:46.097+0530 I CONTROL  [initandlisten]     target_arch: arm
2017-08-08T14:00:46.098+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "/storage/sdcard0/db" } }

Thread 1 "mongod" received signal SIGSEGV, Segmentation fault.
0xb6faacc0 in dlfree () from /system/lib/libc.so

This is the code (from boost 1.64, libs/filesystem/src/operations.cpp) that causes the segfault:

  void directory_iterator_increment(directory_iterator& it,
    system::error_code* ec)
  {
    BOOST_ASSERT_MSG(it.m_imp.get(), "attempt to increment end iterator");
    BOOST_ASSERT_MSG(it.m_imp->handle != 0, "internal program error");

    path::string_type filename;
    file_status file_stat, symlink_file_stat;
    system::error_code temp_ec;

    for (;;)
    {
      temp_ec = dir_itr_increment(it.m_imp->handle,
#       if defined(BOOST_POSIX_API)
        it.m_imp->buffer,
#       endif
        filename, file_stat, symlink_file_stat);

      if (temp_ec)  // happens if filesystem is corrupt, such as on a damaged optical disc
      {
        path error_path(it.m_imp->dir_entry.path().parent_path());  // fix ticket #5900
        it.m_imp.reset();
        if (ec == 0)
          BOOST_FILESYSTEM_THROW(
            filesystem_error("boost::filesystem::directory_iterator::operator++",
              error_path,
              error_code(BOOST_ERRNO, system_category())));
        ec->assign(BOOST_ERRNO, system_category());
        return;
      }
      else if (ec != 0) ec->clear();

      if (it.m_imp->handle == 0)  // eof, make end
      {
        it.m_imp.reset();
        return;
      }

      if (!(filename[0] == dot // !(dot or dot-dot)
        && (filename.size()== 1
          || (filename[1] == dot
            && filename.size()== 2))))
      {
        it.m_imp->dir_entry.replace_filename(
          filename, file_stat, symlink_file_stat);
        return;
      }
    }
  }

Line number 2424 throws a filesystem_error and then it immediately segfaults on return from this function.

BOOST_FILESYSTEM_THROW(
            filesystem_error("boost::filesystem::directory_iterator::operator++",
              error_path,
              error_code(BOOST_ERRNO, system_category())));

This is the exact exception that gets thrown.

Backtrace:

#0  __gnu_Unwind_Resume (ucbp=0x2, entry_vrs=0xbeffe41c) at /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc:482
#1  0xb512856c in ___Unwind_Resume () at /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/libunwind.S:357
#2  0xb5139564 in boost::filesystem::detail::directory_iterator_increment (it=..., ec=<optimized out>) at libs/filesystem/src/operations.cpp:2449
#3  0x2abd0d22 in boost::filesystem::directory_iterator::increment (this=0xbeffe6d0) at /data/data/com.termux/files/usr/include/boost/filesystem/operations.hpp:939
#4  boost::iterators::iterator_core_access::increment<boost::filesystem::directory_iterator> (f=...) at /data/data/com.termux/files/usr/include/boost/iterator/iterator_facade.hpp:555
#5  boost::iterators::detail::iterator_facade_base<boost::filesystem::directory_iterator, boost::filesystem::directory_entry, boost::iterators::single_pass_traversal_tag, boost::filesystem::directory_entry&, int, false, false>::operator++ (this=<optimized out>) at /data/data/com.termux/files/usr/include/boost/iterator/iterator_facade.hpp:665
#6  mongo::(anonymous namespace)::clearTmpFiles () at src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp:222
#7  mongo::MMAPV1Engine::MMAPV1Engine (this=0x2ba09130, lockFile=<optimized out>, cs=<optimized out>, extentManagerFactory=...) at src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp:249
#8  0x2abcfe10 in mongo::MMAPV1Engine::MMAPV1Engine (this=0x2ba09130, lockFile=0xb6fdc0e8 <_gm_>, cs=0x1) at src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp:231
#9  0x2abd5c04 in mongo::(anonymous namespace)::MMAPV1Factory::create (this=<optimized out>, params=..., lockFile=0x2ba08c30) at src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp:48
#10 0x2ab5e54a in mongo::ServiceContextMongoD::initializeGlobalStorageEngine (this=0x2ba30d30) at src/mongo/db/service_context_d.cpp:202
#11 0x2a5a5a74 in mongo::(anonymous namespace)::_initAndListen (listenPort=27017) at src/mongo/db/db.cpp:596
#12 0x2a5a3ed8 in mongo::(anonymous namespace)::initAndListen (listenPort=2) at src/mongo/db/db.cpp:841
#13 mongoDbMain (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at src/mongo/db/db.cpp:1190
#14 0x2a5a3b68 in main (argc=2, argv=0xb6fdc0e8 <_gm_>, envp=0x1) at src/mongo/db/db.cpp:884

If you want to debug it, you can grab the debug binaries from https://drive.google.com/drive/folders/0B8Q4yBRb9PSHdWpORmMzQWhIYUk BEWARE: they have debug symbols and require 2 GB free space pcre is needed because the one in the repos hasn't enabled cpp.

T-vK commented 7 years ago

I'm not really a C++ guy so I can't help too much on this one. Maybe you can ask on Stack Overflow. I'd be willing to throw a bounty at it.

vishalbiswas commented 7 years ago

@T-vK It's for whoever stumbles upon this issue, looking for mongodb on termux. I don't really want to post to stackoverflow or others because I'll probably get responses saying mongodb isn't supported on 32-bit devices. Not tested for 64 bits. This attempt was for 3.4.6. I'll try 3.2 when I give up on this.

dajaj commented 7 years ago

Hi everyone, I'm not sure to understand what worked and what didn't... I have aarch64. Before coming here, I downloaded mongodb from curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.7.tgz, untared it and tried to run it mongodb-linux-x86_64-3.4.7/bin/mongod --dbpath sd/db but it failed : zsh: exec format error: mongodb-linux-x86_64-3.4.7/bin/mongod

vishalbiswas commented 7 years ago

@dajaj That deb is for arm. To build for aarch64 we'll need mozjs configuration for aarch64 Android. My previous comment has steps as to how to generate those files.

vishalbiswas commented 6 years ago

Anybody on arm can help me out? Try this package and report how well it works https://drive.google.com/drive/folders/0B8Q4yBRb9PSHdWpORmMzQWhIYUk Note: You have to install pcre from that folder as well, because the current version in repo doesn't have cpp bindings enabled.

T-vK commented 6 years ago

@vishalbiswas I downloaded the files to my SD and then using Termux I copied them into my home directory. Then I did a chmod 777 on them and also a chown... both commands worked, but when I try to access the files I always get a permission denied. I guess that's some SELinux blackmagic that happens for files on the SD card. I never had this problem when downloading files in Termux with wget directly. Is there any chance you could upload these files to Github, so that I can download them with wget?

vishalbiswas commented 6 years ago

@T-vK github.com doesn't support files larger than 10mb. any other way?

Auxilus commented 6 years ago

@vishalbiswas when i tried to install pcre, it removed tons of my packages, is that supposed to happen?

vishalbiswas commented 6 years ago

@Auxilus no

Auxilus commented 6 years ago

Okay... πŸ˜…

T-vK commented 6 years ago

@vishalbiswas Dang it... I'm gonna try to set up a local http server. This way I should be able to wget the files with Termux over my Wifi..

vishalbiswas commented 6 years ago

@T-vK you can just share that file to termux from any file manager

Auxilus commented 6 years ago

@T-vK there is a cool npm package called http-server

Auxilus commented 6 years ago

@vishalbiswas Can you please help me out with https://github.com/termux/termux-packages/pull/1361 ? The build script is having issue with building gems with native extensions, gives error that couldn't find header files (ruby.h) even though I added sudo apt-get -y install ruby ruby-dev in the script PS: sorry to go off topic to this issue btw

T-vK commented 6 years ago

@vishalbiswas Well, not any. It needs to run on the phone directly, and it needs to have root permissions. But nevertheless, when I copy a file with such a file manager to the Termux home dir, I get the same permission denied problems that I got after doing cp.

Grimler91 commented 6 years ago

@T-vK What exactly are you copying and what exactly are you running when you permission denied?

T-vK commented 6 years ago

@Grimler91 It doesn't matter which file I copy. I get this issue with any file from the SD card. And the permission denied happens for any command. Be it cat, vim or any other command that tries to read the file and probably also any command that tries to write to it or execute it...

vishalbiswas commented 6 years ago

@T-vK I didn't say "copy". I said "share". Tap and hold on a find and click share then select termux. It will be stored in ~/downloads

T-vK commented 6 years ago

@vishalbiswas It seemed to have worked at first. I was able to run mongod. Then from another terminal I started mongo and that seems to have caused both mongod and mongo to crash. Now when I try to run mongod, I get this:

$ mongod
2017-09-13T18:43:43.231+0200 I CONTROL  [main]
2017-09-13T18:43:43.232+0200 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2017-09-13T18:43:43.232+0200 I CONTROL  [main]
2017-09-13T18:43:43.252+0200 I CONTROL  [initandlisten] MongoDB starting : pid=7237 port=27017 dbpath=/data/data/com.termux/files/usr/var/lib/mongodb/db 32-bit host=localhost
2017-09-13T18:43:43.252+0200 I CONTROL  [initandlisten] db version v3.4.9
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] git version: 876ebee8c7dd0e2d992f36a848ff4dc50ee6603e
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] allocator: system
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] modules: none
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten] build environment:
2017-09-13T18:43:43.253+0200 I CONTROL  [initandlisten]     distarch: arm
2017-09-13T18:43:43.254+0200 I CONTROL  [initandlisten]     target_arch: arm
2017-09-13T18:43:43.254+0200 I CONTROL  [initandlisten] options: {}
2017-09-13T18:43:43.254+0200 W -        [initandlisten] Detected unclean shutdown - /data/data/com.termux/files/usr/var/lib/mongodb/db/mongod.lock is not empty.
2017-09-13T18:43:43.418+0200 I -        [initandlisten] Detected data files in /data/data/com.termux/files/usr/var/lib/mongodb/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2017-09-13T18:43:43.447+0200 I STORAGE  [initandlisten]
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] ** WARNING: Readahead for /data/data/com.termux/files/usr/var/lib/mongodb/db is set to 512KB
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead
2017-09-13T18:43:43.448+0200 I STORAGE  [initandlisten] **************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
2017-09-13T18:43:43.449+0200 F -        [initandlisten] Invalid access at address: 0xe
2017-09-13T18:43:43.449+0200 F -        [initandlisten] Got signal: 11 (Segmentation fault).
This platform does not support printing stacktraces
Segmentation fault

When I clear the contents of /data/data/com.termux/files/usr/var/lib/mongodb/db/mongod.lock and run mongod again it keeps running:

mongod
2017-09-13T18:50:20.599+0200 I CONTROL  [main]
2017-09-13T18:50:20.601+0200 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2017-09-13T18:50:20.601+0200 I CONTROL  [main]
2017-09-13T18:50:20.635+0200 I CONTROL  [initandlisten] MongoDB starting : pid=9344 port=27017 dbpath=/data/data/com.termux/files/usr/var/lib/mongodb/db 32-bit host=localhost
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] db version v3.4.9
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] git version: 876ebee8c7dd0e2d992f36a848ff4dc50ee6603e
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] allocator: system
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] modules: none
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] build environment:
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten]     distarch: arm
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten]     target_arch: arm
2017-09-13T18:50:20.636+0200 I CONTROL  [initandlisten] options: {}
2017-09-13T18:50:20.797+0200 I -        [initandlisten] Detected data files in /data/data/com.termux/files/usr/var/lib/mongodb/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten]
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] ** WARNING: Readahead for /data/data/com.termux/files/usr/var/lib/mongodb/db is set to 512KB
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** WARNING: This 32-bit MongoDB binary is deprecated
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten]
2017-09-13T18:50:20.868+0200 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/data/com.termux/files/usr/var/lib/mongodb/db/diagnostic.data'
2017-09-13T18:50:20.871+0200 I NETWORK  [thread1] waiting for connections on port 27017
2017-09-13T18:50:21.001+0200 I FTDC     [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. InvalidBSON: bson length doesn't match what we found in object with unknown _id

From another machine I was then able to access it with mongo:

$ mongo mongodb://192.168.3.7:27017
MongoDB shell version v3.4.3
connecting to: mongodb://192.168.3.7:27017
MongoDB server version: 3.4.9
Server has startup warnings: 
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] 
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] ** WARNING: Readahead for /data/data/com.termux/files/usr/var/lib/mongodb/db is set to 512KB
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          We suggest setting it to 256KB (512 sectors) or less
2017-09-13T18:50:20.826+0200 I STORAGE  [initandlisten] **          http://dochub.mongodb.org/core/readahead
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-09-13T18:50:20.842+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** WARNING: This 32-bit MongoDB binary is deprecated
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] 
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2017-09-13T18:50:20.843+0200 I CONTROL  [initandlisten] 
> use test
switched to db test
>     db.myCollection.insert([
...         {'name': 'Alice', 'age': 30},
...         {'name': 'Bill', 'age': 25},
...         {'name': 'Bob', 'age': 35}
...     ]);
BulkWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 3,
        "nUpserted" : 0,
        "nMatched" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
> db.myCollection.find({})
{ "_id" : ObjectId("59b962f69f61f7ba17cbbb8c"), "name" : "Alice", "age" : 30 }
{ "_id" : ObjectId("59b962f69f61f7ba17cbbb8d"), "name" : "Bill", "age" : 25 }
{ "_id" : ObjectId("59b962f69f61f7ba17cbbb8e"), "name" : "Bob", "age" : 35 }

Edit: Every time I exit mongod, I have to empty /data/data/com.termux/files/usr/var/lib/mongodb/db/mongod.lock to get it running again.

T-vK commented 6 years ago

@vishalbiswas Is there anything else I can do?

better319 commented 6 years ago

it works? may 1 know the step ?like below??

git clone --depth 1 https://github.com/mongodb/mongo cd mongo/src/third_party/mozjs-45 sh get-sources.sh sh gen-config.sh android

or??? download the two ....deb

zawawimanja commented 6 years ago

I am using this link to try with mongodb.Unfortunately it fails.

Link: https://www.w3schools.com/nodejs/nodejs_mongodb_create_db.asp

Anyone know why? Nodejs & mongodb already install.But when to run it fail

T-vK commented 6 years ago

@zawawimanja Have you started the mongod daemon? If not, open a second tab and run mongod. Then try to connect using the terminal based mongo client by running mongo and check if you can create a db from there: https://www.tutorialspoint.com/mongodb/mongodb_create_database.htm If that already fails you can rule out that this problem is related to nodejs.

zawawimanja commented 6 years ago

There is no command mongod in Termux.

On Wed, Jul 25, 2018, 8:05 PM T-vK notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja Have you started the mongod daemon? If not, open a second tab and run mongod. Then try to connect using the terminal based mongo client by running mongo and check if you can create a db from there: https://www.tutorialspoint.com/mongodb/mongodb_create_database.htm If that already fails you can rule out that this problem is related to nodejs.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/249#issuecomment-407731254, or mute the thread https://github.com/notifications/unsubscribe-auth/AjgWu3C9KwkNkt7JpuGzOMOJfsqrxjVlks5uKF8UgaJpZM4IWJR4 .

T-vK commented 6 years ago

@zawawimanja In that case mongodb has not been installed properly. When I did it a year ago I had mongod and mongo.

zawawimanja commented 6 years ago

if u can,make a video tutorial. Really needs it

On Thu, Jul 26, 2018, 4:54 AM T-vK notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja In that case mongodb has not installed properly. When I did it a year ago I had mongod and mongo.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/249#issuecomment-407892111, or mute the thread https://github.com/notifications/unsubscribe-auth/AjgWu5Ps8dFduN96QLNmOlkP3zaRZgYpks5uKNsMgaJpZM4IWJR4 .

better319 commented 6 years ago

actually ,it had worked as i know @T-vK "T-vK commented on 14 Sep 2017 β€’",may i know this steps?

T-vK commented 6 years ago

@zawawimanja Sorry, I don't have the time to make a video tutorial on that. @better319 I can't remember the steps, but I think you can find what I did if you read through all the comments here.

But remember, even though I got it to work it was unstable and had weird issues.

zawawimanja commented 6 years ago

Ok. Thanks. So I will not install it.

Muhammad Zawawi Bin Manja Bachelor Of Information Technology International Islamic University Malaysia http://www.zawawimanja.com | +6013-5372906

On 26 July 2018 at 16:16, T-vK notifications@github.com wrote:

@zawawimanja https://github.com/zawawimanja Sorry, I don't have the time to make a video tutorial on that. @better319 https://github.com/better319 I can't remember the steps, but I think you can find what I did if you read through all the comments here.

But remember, even though I got it to work it was unstable and had weird issues.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/249#issuecomment-408015702, or mute the thread https://github.com/notifications/unsubscribe-auth/AjgWu46B3xFRlgGe9mqkgzUB4EMkF5a5ks5uKXrZgaJpZM4IWJR4 .

better319 commented 6 years ago

when you change congputer ,the mongodb will create a xxx.lock file......even in window.so,i think you step is right .i will try again,did you root you device? @T-vK

T-vK commented 6 years ago

@better319 My device is rooted, yes. I'm not sure if it was necessary though. The lock file is probably there for a good reason. The issue was that I was not able to start mongod again every time it crashed without clearing that file first.

better319 commented 6 years ago

i got it in another way:termux-ubuntu https://github.com/Neo-Oli/termux-ubuntu

  1. install termux-ubuntu 2.install mongodb... 3.it works well image