- Как установить MongoDB Compass в Ubuntu 20.04 LTS
- Как установить MongoDB Compass в Ubuntu 20.04 LTS
- Установите MongoDB Compass на Ubuntu 20.04 LTS Focal Fossa
- Шаг 1. Во-первых, убедитесь, что все ваши системные пакеты обновлены, выполнив следующие apt команды в терминале.
- Шаг 2. Установка MongoDB Compass в Ubuntu 20.04.
- Шаг 3. Доступ к MongoDB Compass в Ubuntu.
- Установка и подключение к MongoDB
- Установка
- Доступ по сети
- Аутентификация
- Примеры подключения из языков программирования
- Release NotesВ¶
- MongoDB Compass 1.28.4В¶
- MongoDB Compass 1.28.1В¶
- MongoDB Compass 1.26.1В¶
- MongoDB Compass 1.26.0В¶
- MongoDB Compass 1.25.0В¶
- MongoDB Compass 1.24.1В¶
- MongoDB Compass 1.23В¶
- MongoDB Compass 1.22В¶
- MongoDB Compass 1.21В¶
- MongoDB Compass 1.20В¶
- MongoDB Compass 1.19В¶
- MongoDB Compass 1.18В¶
- MongoDB Compass 1.17В¶
- MongoDB Compass 1.16В¶
- MongoDB Compass 1.15В¶
- MongoDB Compass 1.14В¶
- MongoDB Compass 1.13В¶
- MongoDB Compass 1.12В¶
- MongoDB Compass 1.11В¶
- MongoDB Compass 1.10В¶
- MongoDB Compass 1.9В¶
- MongoDB Compass 1.8В¶
- MongoDB Compass 1.7В¶
- MongoDB Compass 1.6В¶
- MongoDB Compass 1.5В¶
- MongoDB Compass 1.4В¶
- MongoDB Compass 1.3В¶
- 1.3.0-beta.3 — July 12, 2016В¶
- 1.3.0-beta.2 — June 29, 2016В¶
- 1.3.0-beta.0 — June 27, 2016В¶
- MongoDB Compass 1.2В¶
- 1.2.0-beta.3 — June 23, 2016В¶
- 1.2.0-beta.2 — June 1, 2016В¶
- 1.2.0-beta.1 — May 10, 2016В¶
- MongoDB Compass 1.1В¶
- 1.1.1 — Jan 19, 2016В¶
- MongoDB Compass 1.0В¶
Как установить MongoDB Compass в Ubuntu 20.04 LTS
Как установить MongoDB Compass в Ubuntu 20.04 LTS
В этом руководстве мы покажем вам, как установить MongoDB Compass в Ubuntu 20.04 LTS. Для тех из вас, кто не знал, Mongo DB Compass — это графический интерфейс для программного обеспечения Mongo Database . Это полезное программное обеспечение для тех, кому нужен лучший способ управления своими настройками Mongo DB с графическим интерфейсом. Компас MongoDB позволяет в реальном времени просматривать показатели сервера БД.
В этой статье предполагается, что у вас есть хотя бы базовые знания Linux, вы знаете, как использовать оболочку, и, что наиболее важно, вы размещаете свой сайт на собственном VPS. Установка довольно проста и предполагает, что вы работаете с учетной записью root, в противном случае вам может потребоваться добавить ‘ sudo ‘ к командам для получения привилегий root. Я покажу вам пошаговую установку графического интерфейса MongoDB Compass на Ubuntu 20.04 (Focal Fossa). Вы можете следовать тем же инструкциям для Ubuntu 18.04, 16.04 и любого другого дистрибутива на основе Debian, например Linux Mint.
Установите MongoDB Compass на Ubuntu 20.04 LTS Focal Fossa
Шаг 1. Во-первых, убедитесь, что все ваши системные пакеты обновлены, выполнив следующие apt команды в терминале.
Шаг 2. Установка MongoDB Compass в Ubuntu 20.04.
Теперь скачайте установщик MongoDB Compass с официальной страницы:
Затем установите MongoDB Compass, используя следующую команду:
Шаг 3. Доступ к MongoDB Compass в Ubuntu.
После успешной установки, если вы хотите запустить Compass из командного терминала, просто введите и нажмите клавишу Enter. Принимая во внимание, что вы можете использовать его ярлык, доступный в средстве запуска приложений. Перейдите во все приложение и найдите его, когда появится значок, щелкните, чтобы запустить то же самое. mongodb — compass
Поздравляю! Вы успешно установили MongoDB Compass. Благодарим за использование этого руководства для установки графического интерфейса MongoDB Compass в системе Ubuntu 20.04 LTS Focal Fossa. Для получения дополнительной помощи или полезной информации мы рекомендуем вам посетить официальный сайт MongoDB .
Источник
Установка и подключение к MongoDB
В данной инструкции мы рассмотрим процесс установки MongoDB на Linux Ubuntu (Debian). Также будут приведены примеры настройки подключения по сети, защита соединения с помощью шифрования и аутентификации.
Установка
На странице MongoDB Community Downloads смотрим стабильные версии программного продукта. На момент обновления инструкции это была 4.4.
Обратите внимание, установка MongoDB возможна на большое число популярных операционных систем — Amazon, Debian, Ubuntu, macOS, CentOS, Red Hat, Windows и другие.
Переходим на страницу загрузки ключей для проверки подлинности репозитория. Копируем ссылку для версии MongoDB, которую мы планируем установить:
* в данном примере мы скопировали ссылку на ключ для версии 4.4. Обратите внимание, что также есть возможность загрузки ключей для более свежих и менее стабильных версий.
С помощью скопированной ссылки скачиваем и устанавливаем ключ:
wget -qO — https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add —
Создаем файл для настройки репозитория Ubuntu:
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse
* focal — название релиза Ubuntu. В данном примере, версия 20.04. На данный момент возможны варианты:
- focal: 20.04.
- bionic: 18.04.
- xenial: 16.04.
Обновляем список пакетов:
apt-get install mongodb-org
Стартуем сервис и разрешаем его автозапуск:
systemctl start mongod
systemctl enable mongod
Для подключения к СУБД вводим команду:
Можно для проверки ввести команду, которая покажет созданные базы данных:
После первой установки мы должны увидеть следующее:
admin 0.000GB
config 0.000GB
local 0.000GB
В качестве примера работы мы можем попробовать создать новую базу данных и коллекцию. Объекты в MongoDB создаются автоматически при первом к ним обращении.
Для создания базы просто обращается к ней:
* в данном примере будут создана база newDB.
Для создания коллекции, выполняем команду на вставку данных:
Выходим из оболочки SQL:
Доступ по сети
По умолчанию к установленной базе можно подключиться только с локального компьютера. Рассмотрим процесс настройки сетевого доступа.
Для начала, откроем порт в брандмауэре:
iptables -I INPUT -p tcp —dport 27017 -j ACCEPT
* по умолчанию, MongoDB работает на TCP-порту 27017.
В системах на базе Ubuntu и Debian брандмауэр работает по принципу разрешения. Если мы не меняли данной настройки, то нам не обязательно создавать разрешающее правило для Mongo.
Открываем конфигурационный файл СУБД:
Находим директиву net и в ней опцию bindIp — добавляем IP-адрес, на котором наш сервер должен принимать запросы для MongoDB:
net:
port: 27017
bindIp: 127.0.0.1, 192.168.1.15
* в нашем примере мы добавили к 127.0.0.1 адрес 192.168.1.15 — это сетевой адрес нашего сервера, на котором он должен принимать запросы.
Перезапускаем сервис mongod:
systemctl restart mongod
Чтобы проверить подключение, на другом компьютере должен быть установлен клиент для подключения к Mongo. Процесс его установки схож с установкой сервера. Рассмотрим пример для Ubuntu.
Устанавливаем ключ для репозитория:
wget -qO — https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add —
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse
* как в случае с сервером, focal — название релиза Ubuntu. В данном примере, версия 20.04. Другие варианты: bionic: 18.04, xenial: 16.04.
Обновляем список пакетов:
Устанавливаем клиентскую часть:
apt-get install mongodb-org-shell
Теперь можно подключиться к нашему серверу:
* в данном примере мы подключаемся к серверу MongoDB 192.168.1.15.
Также мы можем использовать MongoDB Compass — это приложение под Windows, Linux и macOS для работы с базой Mongo в графическом интерфейсе. Скачать его можно на странице официального сайта.
Аутентификация
По умолчанию, мы можем подключиться к СУБД без авторизации. Если нам необходимо повысить безопасность работы с базой, можно требовать ввода логина и пароля.
Заходим в командную оболочку Mongo:
Подключаемся к базе admin:
Создаем пользователя, под которым будем авторизовываться:
* в данном примере мы создадим пользователя с правами доступа на все базы. Логин root, пароль будет запрошен после ввода.
Придумываем и вводим пароль
После создания пользователя мы должны увидеть, примерно, следующую картину:
Successfully added user: <
«user» : «root»,
«roles» : [
<
«role» : «userAdminAnyDatabase»,
«db» : «admin»
>,
«readWriteAnyDatabase»
]
>
Выходим из командной оболочки:
Открываем конфигурационный файл:
Находим директиву security и задаем параметр authorization:
security:
authorization: enabled
Перезапускаем сервис mongod:
systemctl restart mongod
Теперь пробуем подключиться к mongo. Мы можем авторизоваться несколькими способами.
а) Авторизация при подключении:
mongo —authenticationDatabase «admin» -u «root» -p
* в данном примере мы подключимся к базе под пользователем root. Пароль будет запрошен системой после ввода команды.
б) Авторизация после подключения:
Теперь усилим безопасность, зашифровав передачу данных. Для этого нам понадобиться сертификат. В нашем примере, мы будем использовать самоподписанный сертификат, но в продуктивной среде, лучше его купить или запросить у Let’s Encrypt.
Создаем каталог, в котором разместим наши сертификаты:
mkdir -p /etc/ssl/mongodb
Сгенерируем самоподписанный сертификат:
openssl req -new -x509 -days 1461 -nodes -out /etc/ssl/mongodb/cert.pem -keyout /etc/ssl/mongodb/cert.pem -subj «/C=RU/ST=SPb/L=SPb/O=Global Security/OU=IT Department/CN=mongo.dmosk.local/CN=mongo»
Выставим в качестве владельца на файлы сертификата пользователя mongodb:
chown mongodb:mongodb /etc/ssl/mongodb/cert.pem
Открываем конфигурационный файл СУБД:
В директиву net дописываем опции TLS:
net:
.
tls:
mode: requireTLS
certificateKeyFile: /etc/ssl/mongodb/cert.pem
* в данном примере мы указали необходимость шифрования данных при передаче, а также путь до сгенерированного нами сертификата.
Перезапускаем сервис mongod:
systemctl restart mongod
Для подключения к базе с использованием шифрования используем команду:
mongo —tls —tlsAllowInvalidCertificates
* в данном примере мы указываем при подключении использовать шифрование с использованием TLS. Опция tlsAllowInvalidCertificates говорит, что клиент должен принять неправильный сертификат (так как у нас он самоподписанный).
Так как у нас еще настроена аутентификация, для подключения введем такую команду:
mongo —tls —tlsAllowInvalidCertificates —authenticationDatabase «admin» -u «root» -p
Для подключения к нашему серверу по сети, полная команда будет такой:
mongo «mongodb://192.168.1.15:27017» —tls —tlsAllowInvalidCertificates —authenticationDatabase «admin» -u «root» -p
Примеры подключения из языков программирования
Рассмотрим небольшие примеры для подключения к MongoDB из языков программирования PHP и Python.
Для возможности работы PHP с Mongo необходимо установить соответствующее расширение. Выполняем пошагово следующие действия:
apt-get install php-pear php-dev
pecl channel-update pecl.php.net
pecl install mongodb
Для каждого возможного варианта использования PHP необходимо создать отдельный конфигурационной файл. В данном примере, под php 7.4 для cli, php-fpm, apache.
Источник
Release NotesВ¶
MongoDB Compass 1.28.4В¶
Released August 30, 2021
- Enables resizing the preview area for aggregation pipelines.
- Allows hiding the Query History and Export to Language buttons in the query view.
- Bumps mongosh version for the embedded shell to 1.0.4 .
- Properly supports all Kerberos options.
- Fixed an issue with geospatial queries being incorrectly merged.
MongoDB Compass 1.28.1В¶
Released July 13, 2021
- Adds support for load balancer connections.
- Adds a Granularity option when creating a time series collection.
- Disallows editing schema validation for time series collections.
- Hides the Drop Collection button in readonly Compass.
- Geoqueries no longer populate query bar fields with null .
MongoDB Compass 1.26.1В¶
Released April 9, 2021
- Allows functions in the query bar and aggregations.
- When navigating to the Databases view, Compass now clears a previously selected collection from the left navigation.
- Updates the embedded MongoDB Shell to version 0.9.0 .
- Compass now displays the expected value when you update fields in the table view.
- Creating a collection or database is now prohibited when form fields are empty.
- Schema tab graphs no longer fail to render when switching tabs.
- SSH tunnel no longer hangs on disconnect.
MongoDB Compass 1.26.0В¶
Released March 3, 2021
- Adds ability to create text indexes.
- Adds ability to cancel a connection attempt.
- Data is now refreshed when Find is clicked in the query bar.
- Improvements to schema analysis to prevent timeouts with large datasets.
- Improves connection form input and validation.
- MongoDB Compass prevents inserting data via the JSON editor without specifying a document. Previously, Compass would silently error when a document was not specified.
- Saving a favorite connection no longer freezes MongoDB Compass.
- Stylistic fixes.
MongoDB Compass 1.25.0В¶
Released January 13, 2021
- Updates the embedded MongoDB Shell to version 0.6.1 .
- Improvements to connection validation.
- Compass no longer crashes during startup on certain versions of Windows. For more information see COMPASS-4510.
- When connecting to a MongoDB deployment, Compass no longer automatically inserts a value of 27017 for Port when Port is left blank.
- Compass no longer displays the incorrect port number when connecting to MongoDB via SRV record.
MongoDB Compass 1.24.1В¶
Released December 9, 2020
- Adds support for updates on sharded collections.
- Adds support for the print() method in the embedded MongoDB Shell.
- Updates the embedded MongoDB Shell to version 0.5.2 .
- Provides better readonly and view handling.
- Adds support for multi-line string editing in the field-by-field editor.
- Provides a descriptive tooltip when selecting an aggregation stage in the Aggregation Pipeline Builder.
- Non-editable fields can now be deleted in the field-by-field editor.
- Fixes connection URI issues with SCRAM-SHA-256.
- Adds support for $out when connected to a Data Lake.
- Removes broken import and export sidebar actions.
- Improves x.509 authentication. Makes the x.509 username optional in connection validation and improves validation error messages.
- Various other bug fixes and improvements.
MongoDB Compass 1.23В¶
Released November 4, 2020
- Notarizes MongoDB Compass for macOS Catalina. You should no longer need to manually allow macOS to trust MongoDB Compass before running.
- Kerberos authentication improvements on RHEL7.
- Importing a text pipeline containing a $out stage no longer crashes MongoDB Compass .
- Various other bug fixes and improvements.
MongoDB Compass 1.22В¶
Released September 3, 2020
- Added an embedded MongoDB Shell. You can use MongoDB Shell to test queries and operations in an interactive JavaScript interface.
MongoDB Compass 1.21В¶
Released April 28, 2020
- Improved CSV parsing when importing data.
- Added support for importing a subset of fields from CSV.
MongoDB Compass 1.20В¶
On macOS systems, the first time that you update MongoDB Compass to version 1.20 or later, you will need to allow access to your system storage for each saved connection in Recents and Favorites . To learn more, see Allow Keychain Access for Recent and Favorite Connections.
Released December 5, 2019
- Added the option to include driver syntax when exporting queries to a language.
- New and improved Connection experience with support for all connection options.
- Improved user experience for saving and sharing Favorite Connections.
- Added JSON mode for managing documents. With JSON mode, you can now insert multiple documents at once.
- Added support for querying UUIDs via the Documents query bar or in the Aggregation Pipeline Builder.
Added support for the following aggregation pipeline operators:
- $set
- $unset
- $replaceWith
MongoDB Compass 1.19В¶
Released August 11, 2019
Added support for:
- Views. You can create views based on results from an aggregation pipeline.
- Wildcard Indexes.
- Killing long-running operations from the Performance Tab.
- Adjusting the maximum timeout for queries executed in the Query Bar.
MongoDB Compass 1.18В¶
Released May 17, 2019
Provided fixes to the Compass Windows installer. With the new .msi installer you can:
- Select the destination of the Compass installation.
- Install Compass for all users.
- Script the Compass installation and perform a quiet install.
- Added support for JSON schema validation.
- Includes smart editor with autocomplete.
MongoDB Compass 1.17В¶
Released March 4, 2019
- Performance improvements to the Documents and Aggregation tabs, specifically with deeply nested documents.
Fixed several connection issues.
- Fixed Kerberos connections where hostname is not the canonical name.
- Fixed SRV connections with special characters in the password.
- Compass no longer allows direct connections to secondary databases, which would result in hangs on the loading navigation screen.
- Fixed connections to M0 Atlas clusters with readonly users.
MongoDB Compass 1.16В¶
Released November 12, 2018
Added collation support to the following features:
- Create a Collection
- Create a Database
- Create an Index
- Query Your Data
- Aggregation Pipeline Builder
MongoDB Compass 1.15В¶
Released August 23, 2018
Added support for exporting aggregation pipelines and exporting queries in the syntax of the following languages:
MongoDB Compass 1.14В¶
Released June 26, 2018
- Added Aggregation Pipeline Builder, which provides the ability to execute aggregation pipelines to gain additional insight into your data.
- Added MongoDB Compass Isolated Edition for highly secure environments. This edition does not initiate any network requests except to the MongoDB server.
MongoDB Compass 1.13В¶
Released May 3, 2018
- Added ability to import and export data in JSON and CSV format.
MongoDB Compass 1.12В¶
Released March 5, 2018
Added MongoDB Compass Readonly Edition which limits certain CRUD operations within your organization.
The following actions are not permitted in Compass Readonly Edition:
- Create and drop databases
- Create and drop collections
- Create, delete, edit and clone documents
- Create and drop indexes
- Create, delete and edit document validation rules
All other functionality remains the same as in standard MongoDB Compass .
MongoDB Compass 1.11В¶
Released December 17, 2017
- Added support for plugins that extend the functionality of MongoDB Compass .
- Added support for disconnecting from the active MongoDB instance without restarting MongoDB Compass .
- Added Table View for documents as a method of viewing the contents of a collection in tabular format.
MongoDB Compass 1.10В¶
Released Oct 25, 2017
Now available in two editions, Compass Community and Compass.
Compass provides the following features not in the Community edition:
MongoDB Compass 1.9В¶
Released Oct, 2017
- Added autocomplete functionality to the query bar.
- Query History Compass automatically stores up to 20 most recent queries for each collection. From the past queries view for a collection, you can view the recent queries as well as the queries saved as favorites . For more information, see View Past Queries.
- Deployment Awareness
When a user connects to a MongoDB instance, Compass now displays:
- The connection name if the connection is a favorite connection or «My Cluster» if it is not.
- The type of deployment (standalone, replica set, sharded cluster). If the deployment is a replica set and the replica set name is specified in the connection window, the number of replica set members will also be displayed.
For more information, see Compass Home.
MongoDB Compass 1.8В¶
Released Aug 2, 2017
- Documents tab is the default
- Schema sampling only on demand
- Explain executed only on demand
- Improved Document Editing
Deployment Awareness (and read preference)
- Added ability to specify replica set name and read preference in connection screen.
- Added ability to parse MongoDB URI string in the connection screen.
MongoDB Compass 1.7В¶
Released Jun 7, 2017
- Added ability to include options in the query bar.
- Added ability to add or delete database/collection from the left-hand navigation sidebar.
- Added ability to collapse the left-hand navigation sidebar.
MongoDB Compass 1.6В¶
Released Mar 1, 2017
- Added support for Linux: Ubuntu 14.04+ and RHEL 7+.
- Added ability to zoom in and zoom out of panels.
MongoDB Compass 1.5В¶
Released Nov 29, 2016
- Added ability to create and drop databases.
- Added ability to create and drop collections.
- Added ability to create indexes.
- Added support for document validation.
- Improved security when connecting to Atlas. During Connection setup, MongoDB Compass supports the use of System Certificate Authority for TLS/SSL connections to Atlas Deployment.
- Provides Real Time Performance stats.
MongoDB Compass 1.4В¶
Released Nov 1, 2016
- Add support for connecting to Atlas.
- Various bug fixes and improvements.
MongoDB Compass 1.3В¶
Released Sep 15, 2016
1.3.0-beta.3 — July 12, 2016В¶
- Allow specifying the value of the _id field when inserting new documents.
- Set the default field and value sizes to 1 when adding a new key to a document.
- Typing » : » in the key input field tabs to the value input field when editing a document.
- Only allow addition of one element at a time if the field name in the new element is blank when editing a document.
- CRUD documentation now available in the application help menu.
- Fix element autofocus on add.
1.3.0-beta.2 — June 29, 2016В¶
- Bug: Small Bug Fixes identified at MongoDB World
1.3.0-beta.0 — June 27, 2016В¶
- New: CRUD single document create, update, delete
- New: SSH tunnel support
- New: Tree explain plan view
- New: Geographic query builder and visualization
- Explicit opt-in for «3rd party maps» usage
- Improve display of binary data in in the document viewer
- Query builder on numeric histograms should leave bounds open
- Intercom overlay button now visible
- Load preferences defensively, catching parsing errors and reset preferences
- Compass Treasure Hunt for MongoDB World
MongoDB Compass 1.2В¶
Released Jun 27, 2016
- Beta installs alongside the stable release as a distinct application, with distinct preferences
- Index view
- Explain plan view
- Documents view moved to a separate tab
- Automatic updates
1.2.0-beta.3 — June 23, 2016В¶
- Bug: Feature Tour does not show on first launch
- Bug: Compass fails to start with JavaScript error in main process: SyntaxError: Unexpected end of input
- Bug: No error displayed message when an authentication error occurs
- Bug: Compass does not handle $indexStats fetch failure on MongoDB 3.2
1.2.0-beta.2 — June 1, 2016В¶
- NEW: Added explain plan view
- Added feature tour points of new 1.2 features
- Bugfix: After increasing maxTimeMS timeout, query default falls back to 100 docs
1.2.0-beta.1 — May 10, 2016В¶
MongoDB Compass 1.1В¶
Released Jan 19, 2016
1.1.1 — Jan 19, 2016В¶
MongoDB Compass 1.0В¶
Released Dec 7, 2015
MongoDB Compass 1.0 is now available. It helps users to visually analyze and understand their MongoDB data.
Источник