Node JS mongoose无法连接到远程mongodb服务器

时间:2015-10-12 12:04:44

标签: node.js mongodb mongoose

VM 192.168.26.103 内的脚本正在尝试连接到VM上的MongoDB 192.168.26.104

' ECONNREFUSED' 错误

    @DataProvider (name=getData)
                public static Object[][] getData(){
                    Excelreader excel = new Excelreader("C:\\WorkspaceExcel\\Datasource.xlsx"); private static
        String sheetName="SmokeTest"; // Test Data stored in a a table with
        columns and rows. Ex. UserNmae and password are the columns and data
        for them in rows  private static String tableName="CreatePolicy";

        // Some logic to read the data table store the data in a 2
        dimentional array.

        // Some logic by which I store the columns as Keys and data for them
        as values in a HASHTABLE  Return the hashtable 
    }




       @Test (dataProvider="getData") 
        public void testData(Hashtable<String, String> data){
        /* Logic to read an .xlsx file which has Snenario name, TestCase Name  and its corespnding runflag. If the runflag is true i need to read the scenario name and testcase name from the .xlsx file.  */

/* I need some logic to pass the ScenarioName (equivalent to Sheetname in DP) and TestCase Name (equivalent to datatable name in DP) which i am getting by reading the excelfile to DataProvider, so i can get the data which i need to execute the test case */

/*I am doing the above as part of Hybridframework, where i have Scenario, TC, Test step details in one excel sheet and data for each testcase in one more sheet */
       }

错误:

{{1}}

1 个答案:

答案 0 :(得分:3)

我自己解决了这个问题。发布以下解决方案,以便有人可能会发现有用的信息。

在远程MongoDB服务器192.168.26.104中,我更改了bind_ip,现在我的脚本可以成功连接到它

/etc/mongod.conf

来自bind_ip = 127.0.0.1

bind_ip = 192.168.26.104

service mongod restart
相关问题