{"id":8569,"date":"2015-02-17T22:33:23","date_gmt":"2015-02-17T22:33:23","guid":{"rendered":"https:\/\/wp.okra.host\/article\/running-mongodb\/"},"modified":"2021-03-07T14:30:33","modified_gmt":"2021-03-07T13:30:33","slug":"running-mongodb","status":"publish","type":"ht_kb","link":"https:\/\/kb.okra.host\/de\/article\/running-mongodb\/","title":{"rendered":"Ausf\u00fchren von MongoDB"},"content":{"rendered":"<h2 id=\"overview\" >\u00dcbersicht<\/h2>\n<p><a href=\"http:\/\/www.mongodb.org\/\">MongoDB<\/a>\u00a0is fast, document-oriented <a href=\"http:\/\/en.wikipedia.org\/wiki\/NoSQL\">NoSQL<\/a>\u00a0server. It&#8217;s complementary to key-value cache stores like <a title=\"Laufender Redis\" href=\"https:\/\/kb.okra.host\/de\/guides\/running-redis\/\">Redis<\/a> or Memcached and is suitable <a href=\"http:\/\/stackoverflow.com\/questions\/5400163\/when-to-redis-when-to-mongodb\">when necessary<\/a>. It is available on <a title=\"Ermitteln der Plattformversion\" href=\"https:\/\/kb.okra.host\/de\/platform\/determining-platform-version\/\">newer platforms<\/a> (v6+) without any <a title=\"Programme kompilieren\" href=\"https:\/\/kb.okra.host\/de\/terminal\/compiling-programs\/\">additional compilation<\/a> from source. Accounts <a title=\"Ist ein Terminalzugang vorhanden?\" href=\"https:\/\/kb.okra.host\/de\/terminal\/is-terminal-access-available\/\">with terminal access<\/a> are eligible to use MongoDB.<\/p>\n<h2 id=\"quickstart\" >Schnellstart<\/h2>\n<ol>\n<li>From the <a title=\"Zugriff auf das Terminal\" href=\"https:\/\/kb.okra.host\/de\/terminal\/accessing-terminal\/\">Terminal<\/a>, first create a directory to store MongoDB data:\n<ul>\n<li>\n<pre data-language=\"shell\"><code>mkdir ~\/mongodb<\/code><\/pre>\n<ul>\n<li>A directory named <code>mongodb<\/code> within your <a title=\"Standort des Home-Verzeichnisses\" href=\"https:\/\/kb.okra.host\/de\/platform\/home-directory-location\/\">home directory<\/a> will be created. If the user logged is in named <code>example<\/code>, then a directory named <code>\/home\/example\/mongodb<\/code> will be created<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Now start the server. Substitute PORT for a <a title=\"Abh\u00f6ren von Ports\" href=\"https:\/\/kb.okra.host\/de\/terminal\/listening-ports\/\">preassigned port<\/a> for your account:\n<ul>\n<li><code>mongod --bind_ip 127.0.0.1 --port PORT\u00a0--dbpath ~\/mongodb --logpath ~\/mongo.log --pidfilepath ~\/mongodb.pid --fork<\/code><\/li>\n<li>MongoDB is now running, accessible by a local TCP\/IP socket bound to port\u00a0<em>PORT<\/em>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><span style=\"color: #ff0000\"><strong>Hinweis:<\/strong><\/span> use 127.0.0.1 to prevent outside network activity. 127.0.0.1 will only allow traffic that originates from the same server. A better solution, if using <a title=\"Node.js ausf\u00fchren\" href=\"https:\/\/kb.okra.host\/de\/guides\/running-node-js\/\">Node.js<\/a> oder\u00a0<a title=\"Einrichten von Rails mit Passenger\" href=\"https:\/\/kb.okra.host\/de\/ruby\/setting-rails-passenger\/\">Schiene<\/a> application, is to specify <code>--unixSocketPrefix<\/code><code>\u00a0\/tmp\/mongodb.sock<\/code> anstelle von <code>--bind_ip<\/code>\/<code>--port<\/code> to specify a local UNIX domain socket instead of a TCP socket.<\/p>\n<h2 id=\"configuring-daemonizing\" >Configuring &#038; Daemonizing<\/h2>\n<p>Now with MongoDB\u00a0up and running, you can create\u00a0a long-term solution that starts up with the server and always runs in the background. Start with the configuration template provided above, making sure to update the <code>port<\/code> parameter to a <a title=\"Abh\u00f6ren von Ports\" href=\"https:\/\/kb.okra.host\/de\/terminal\/listening-ports\/\">port assigned<\/a> to your account.<\/p>\n<blockquote>\n<p><strong>Note<\/strong>: as with most configuration files, any line that begins with a octothorpe\/pound\/hash symbol (#) denotes a comment. These are never interpreted by an application, but serve as guidance. The following\u00a0configuration omits these helpful comments for brevity.<\/p>\n<\/blockquote>\n<p>Copy and paste the following content to a file named <code>mongodb.conf<\/code> in your <a title=\"Standort des Home-Verzeichnisses\" href=\"https:\/\/kb.okra.host\/de\/platform\/home-directory-location\/\">home directory<\/a>:<\/p>\n<pre style=\"padding-left: 60px\">bind_ip = 127.0.0.1 \n############\n# Substitute with a PORT assigned to your account\n############\nport = PORT \n# run as a service\nfork = true \n############\n# Substitute \/home\/example for your HOME DIRECTORY\n############\npidfilepath = \/home\/example\/mongod.pid \nlogpath = \/home\/example\/mongodb.log \ndbpath = \/home\/example\/mongodb \njournal = true\nnohttpinterface = true<\/pre>\n<p>A quick and easy way to do this is with Vim, a text-editor available through the terminal:<\/p>\n<ol>\n<li><code>vim ~\/mongodb.conf<\/code><\/li>\n<li>Type <code>i<\/code>\u00a0on the keyboard to switch to &#8220;Insert&#8221; mode\n<ul>\n<li>Depending upon\u00a0client, paste the text through CTRL + V, Shift + INS, or a suitable\u00a0key combination<\/li>\n<\/ul>\n<\/li>\n<li>Hit the Esc(ape) key.<\/li>\n<li>Type\u00a0<code>:wq<\/code><\/li>\n<li><em>Done!<\/em><\/li>\n<\/ol>\n<p>Now to start MongoDB\u00a0using the configuration, type: <code>mongod -f ~\/mongodb.conf<\/code><\/p>\n<h3 id=\"starting-on-start-up\" >Starting on Start-up<\/h3>\n<ol>\n<li>Visit <strong>Dev<\/strong> &gt;\u00a0<strong>Task Scheduler<\/strong> innerhalb der <a title=\"Anmeldung am Bedienfeld\" href=\"https:\/\/kb.okra.host\/de\/control-panel\/logging-into-the-control-panel\/\">Bedienfeld<\/a>\u00a0to schedule a new task.<\/li>\n<li>Under\u00a0<strong>Command<\/strong>, enter <code>mongodb ~\/mongodb.conf<\/code><\/li>\n<li>Under <em>Scheduling<\/em>, select\u00a0<strong>Server Start<\/strong><\/li>\n<li>Click\u00a0<strong>Add<\/strong><\/li>\n<\/ol>\n<h2 id=\"see-also\" >Siehe auch<\/h2>\n<ul>\n<li>MongoDB <a href=\"http:\/\/docs.mongodb.org\/manual\/\">Dokumentation<\/a><\/li>\n<li><a href=\"http:\/\/openmymind.net\/2011\/3\/28\/The-Little-MongoDB-Book\/\">The Little MongoDB Book<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Overview MongoDB\u00a0is fast, document-oriented NoSQL\u00a0server. It&#8217;s complementary to key-value cache stores like Redis or Memcached and is suitable when necessary. It is available on newer platforms (v6+) without any additional compilation from source. Accounts with terminal access are eligible to use MongoDB. Quickstart From the terminal, first create a directory&#8230;<\/p>","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[60],"ht-kb-tag":[],"class_list":["post-8569","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-guides"],"_links":{"self":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb\/8569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/comments?post=8569"}],"version-history":[{"count":1,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb\/8569\/revisions"}],"predecessor-version":[{"id":8570,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb\/8569\/revisions\/8570"}],"wp:attachment":[{"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/media?parent=8569"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb-category?post=8569"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/kb.okra.host\/de\/wp-json\/wp\/v2\/ht-kb-tag?post=8569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}