Space banner

   

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Setting up Search with Social database in Smart IT

Elasticsearch is a flexible and powerful open-source, distributed, real-time search and analytics engine. If you do not install Elasticsearch, BMC Remedy with Smart IT (Smart IT) and BMC MyIT use the built-in search of MongoDB.

Best practice

Because of security vulnerabilities in the compatible version of Elasticsearch, BMC recommends that you use MongoDB 3.0.x without Elasticsearch. With the release of MongoDB 3.0, the performance of MongoDB full text search (FTS) is equivalent or superior to Elasticsearch. BMC strongly recommends that customers use MongoDB FTS with MongoDB 3.0, which is supported in BMC MyIT 3.0 and Smart IT 1.3 and later versions. If you use ElasticSearch, follow the additional mitigation described in Security vulnerabilities when using Elasticsearch with MongoDB.

Use the following process to configure MongoDB to use Elasticsearch:

Before you begin

Before starting this procedure, complete the following tasks:

  • Verify that the JAVA_HOME environment variable is set. 
  • Install MongoDB.
  • For high availability, configure MongoDB replica sets.
  • Take note of the installation path of Elasticsearch 1.4.2 bundled with the installer; for example:
    C:\program files\BMC Software\smart_it_myit\smart_it_myit\elasticsearch

To configure MongoDB to use Elasticsearch

  1. To configure the social database MongoDB to use Elasticsearch, perform the following steps:

    1. Open the config.js file in InstallationDirectory\Smart_IT_MyIT\Smart_IT_MyIT\social\.

    2. Add the following three lines:

      search_type:1
      search_hosts:["elasticSearchServerIPaddress"]
      search_host_port:"elasticsearchPort"

      For high availability environments, the search_hosts parameter must include all the Elasticsearch servers:
      search_hosts:["elasticSearchServerOneIPaddress", "elasticSearchServerTwoIPaddress"]

      The Elasticsearch port is typically 9200.

    3. Save the config.js file.
  2. If MongoDB is configured for authentication, perform the following steps:
    1. Log on to the mongo shell with the pathToMongoDB/bin/mongo command.
    2.  To be authorized as a user with userAdminAnyDatabase permission, enter the following commands:
      1. use admin
      2. db.auth("username", "password")
    3. Create two users with only the read role for admin and social database:
      db.adduser( { user: "elasticsearchuser", pwd: "password", roles: [ "read" ] } )

    4. To configure the River plug-in, use the curl command to add the indexes for activities, subactivities, users, and resources. Replace the IP addresses and passwords in the following command:

       

      curl -XPUT "http://<elasticsearch-server-ip>:9200/_river/activitysearch/_meta" -d '
      {
      "type": "mongodb",
      "mongodb": {
      "servers": [
      { "host": "mongodb_primary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 }
      ],
      "db": "social",
      "collection": "activities",
      "credentials": [
      {
      "db": "admin",
      "user": "elasticsearchuser",
      "password": "<password>"
      },
      {
      "db": "social",
      "user": " elasticsearchuser ",
      "password": "<password>"
      }
      ]
      },
      "index": {
      "name": "activitysearch",
      "type": "activities"
      }
      }'
      curl -XPUT "http:// <elasticsearch-server-ip>:9200/_river/subactivitysearch/_meta" -d '
      {
      "type": "mongodb",
      "mongodb": {
      "servers": [
      { "host": "mongodb_primary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 }
      ],
      "db": "social",
      "collection": "subactivities",
      "credentials": [
      {
      "db": "admin",
      "user": "elasticsearchuser",
      "password": "<password>"
      },
      {
      "db": "social",
      "user": " elasticsearchuser ",
      "password": "<password>"
      }
      ]
      },
      "index": {
      "name": "subactivitysearch",
      "type": "subactivities"
      }
      }'
      curl -XPUT "http:// <elasticsearch-server-ip>:9200/_river/usersearch/_meta" -d '
      {
      "type": "mongodb",
      "mongodb": {
      "servers": [
      { "host": "mongodb_primary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 }
      ],
      "db": "social",
      "collection": "users",
      "credentials": [
      {
      "db": "admin",
      "user": "elasticsearchuser",
      "password": "<password>"
      },
      {
      "db": "social",
      "user": " elasticsearchuser ",
      "password": "<password>"
      }
      ]
      },
      "index": {
      "name": "usersearch",
      "type": "users"
      }
      }'
      curl -XPUT "http:// <elasticsearch-server-ip>:9200/_river/resourcesearch/_meta" -d '
      {
      "type": "mongodb",
      "mongodb": {
      "servers": [
      { "host": "mongodb_primary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 },
      { "host": "mongodb_secondary_ip", "port": 27017 }
      ],
      "db": "social",
      "collection": "resources",
      "credentials": [
      {
      "db": "admin",
      "user": "elasticsearchuser",
      "password": "<password>"
      },
      {
      "db": "social",
      "user": " elasticsearchuser ",
      "password": "<password>"
      }
      ]
      },
      "index": {
      "name": "resourcesearch",
      "type": "resources"
      }
      }'
  3. Restart the social service:
    (Windows) MyITSocialService
    (Linux) socialserviced

To verify the Elasticsearch indexes

On the Elasticsearch server, open a web browser and confirm that the following queries provide the expected results:

QueryExpected result
http://localhost:9200/_statsjson with the indexes created.
http://localhost:9200/usersearch/_search?prettyNumber of tickets indexed matches the database count.
http://localhost:9200/activitysearch/_search?pretty  Number of tickets indexed matches the database count.
http://localhost:9200/subactivitysearch/_search?prettyNumber of work logs and comments indexed matches the database count.
http://localhost:9200/resourcesearch/_search?pretty Number of assets and points of interest (POI) indexed matches the database count.
Search for users in your database. For example, http://localhost:9200/usersearch/_search?q=Allen&prettyUsers match the users in the database.

Related topics 

Configuring MongoDB for Smart IT

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments