none
Elastic Search Connect to Mongo Database Server RRS feed

  • Question

  • basically, I know the difference between MongoDB and the ES. In my server I have installed MongoDB instance separately will name it as (MDB1) and I installed ES instance separately will name it as (ESS). Currently, I am working on document management system, daily storing millions different kind of document information in Mongo DB. I have browsed many websites but I didn't get my answer as expected. 

    My question is, I want to connect ESS to MDB1, coz I using ES to search and analyze the data. Is there have any method to connect ES to existing MongoDB instance. (I am using C#.net)

    Gehan Fernando Snr. Engineer Technology. AKLO Information Technologies (Pvt) Ltd. #58, 42nd Lane, 5th Floor, Wellawatta, Colombo 06, Sri Lanka. Phone: +94 117 520000 | Mobile: +94 772 269625

    • Moved by Sabah ShariqMVP Friday, March 23, 2018 1:17 PM Moved From Visual C#
    Friday, March 23, 2018 1:37 AM

All replies

  • This is Visual C# forum as your issue is related to third party product you have to ask on their on their site how to use their product with Microsoft product. I am moving this thread to off-topic.

    Elasticsearch Forum


    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Friday, March 23, 2018 1:16 PM
  • 1. Install MongoDB (Community Server)
    2. Configure MongoDB

    net:
    bindIp: 127.0.0.1
    port: 27017
    replication:
    oplogSizeMB: 1024
    replSetName: res0
    storage:
    dbPath: C:\data\db\rs0
    systemLog:
    timeStampFormat: iso8601-utc
    destination: file
    path: C:\data\log\rs0\mongod.log
    Create two file using above configuration save it as
    (mongod_primary.cfg and mongod_secondary.cfg)

    Install as Service
    mongod --config "C:\Program Files\MongoDB\Server\3.6\mongod_primary.cfg" --install --serviceName "MongoDB_Primary" --serviceDisplayName "MongoDB Primary"
    mongod --config "C:\Program Files\MongoDB\Server\3.6\mongod_secondary.cfg" --install --serviceName "MongoDB_Secondary" --serviceDisplayName "MongoDB Secondary"

    Start services (Primary and Secondary) instance

    3. Connect to primary database
    4. Use rs.initiate() command
    5. Use rs.add("127.0.0.1:27018") command
    6. Use rs.config() command
    7. Use rs.status() command
    8. Install Java latest version and set java home path in variable environment
    9. Install Elasticsearch
    10. Go to Elasticsearch folder and open config folder
    11. Set following configuration in .yml file

    cluster.name: home_server
    node.name: gehan-pc
    path.data: C:\Elasticsearch\data
    path.logs: C:\Elasticsearch\logs
    network.host: 127.0.0.1
    network.bind_host: 0.0.0.0
    http.port: 9200
    http.cors.enabled : true
    http.cors.allow-origin : "*"
    http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
    http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length

    12. Install following files
    pip install mongo-connector[elastic5]
    pip install elastic2-doc-manager[elastic5]

    13. Start Elasticsearch instance
    14. Run this command. mongo-connector --auto-commit-interval=0 -d elastic_doc_manager -t localhost:9200
    15. Run this command http://localhost:9200/_cat/indices?v to check is mongo collections sync with Elasticsearch server


    Gehan Fernando Snr. Engineer Technology. AKLO Information Technologies (Pvt) Ltd. #58, 42nd Lane, 5th Floor, Wellawatta, Colombo 06, Sri Lanka. Phone: +94 117 520000 | Mobile: +94 772 269625

    Wednesday, April 4, 2018 12:50 AM