Elasticsearch 5.1.1无法绑定本地IP地址

时间:2017-02-17 05:38:10

标签: elasticsearch ip-address

我正在尝试使用以下配置在ES yml文件中映射本地IP地址 network.bind_host:0 并低于错误

线程“main”中的异常以解析发布地址];嵌套:

protected void GVSample_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.`enter code here`RowType == DataControlRowType.DataRow)
            {
                string variable = e.Row.Cells[8].Text.ToString();
                string[] stringSeparators = { ";" };
                string[] result;
                result = variable.Split(stringSeparators, StringSplitOptions.None);

                foreach (string s in result)
                {
                    if (e.Row.RowType == DataControlRowType.DataRow)
                    {
                        LinkButton lb = new LinkButton();
                        lb.Text = s.ToString() + "<br />";
                        lb.CommandName = "ApproveVacation";
                        lb.Command += LinkButton_Command;
                        e.Row.Cells[8].Controls.Add(lb);
                    }
                }
            }
        }

protected void LinkButton_Command(object sender, CommandEventArgs e)
        {
            string val = ((LinkButton)sender).Text;
            int row = -1;
            int.TryParse(e.CommandArgument as string, out row);
            if (row == -1)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "displayalertmessage", "alert('Fail to Open File');", true);
                return;
            }
            GridViewRow gdrow = GridView1.Rows[row];
            DataRow dr = ((DataTable)this.GridView1.DataSource).Rows[gdrow.DataItemIndex];
            if (e.CommandName == "ApproveVacation")
            {
                try
                {
                    string username = "Bla";
                    string password = "bla";
                    System.Net.NetworkCredential readCredentials = new NetworkCredential(username, password);

                    string filepath = @"\\192.168.1.100\SAPAttachments\abc";
                    using (new NetworkConnection(filepath, readCredentials))
                    {
                        WebClient User = new WebClient();
                        string file = ((LinkButton)sender).Text;
                        string a = @"<br />";
                        file = file.Replace(a, "");
                        foreach (var item in file)
                        {
                            Byte[] FileBuffer = User.DownloadData(file);
                            string stringCutted = file.Substring(file.LastIndexOf(".") + 1);
                            if (stringCutted == "docx" || stringCutted == "DOCX")
                            {
                                if (FileBuffer != null)
                                {
                                    Context.Response.Clear();
                                    FileInfo Sourcefile = new FileInfo(file);
                                    Context.Response.ContentType = "Application/msword";
                                    Context.Response.AppendHeader("Content-Disposition", "inline; filename=" + Sourcefile.Name);
                                    Context.Response.AppendHeader("Content-Length", Sourcefile.Length.ToString());
                                    Context.Response.WriteFile(Sourcefile.FullName);
                                    Context.Response.End();
                                }
                            }

                            if (stringCutted == "pdf" || stringCutted == "PDF")
                            {
                                if (FileBuffer != null)
                                {
                                    Response.ContentType = "application/pdf";
                                    Response.AddHeader("content-length", FileBuffer.Length.ToString());
                                    Response.BinaryWrite(FileBuffer);
                                    Response.End();
                                }
                            }


                            if (stringCutted == "jpg" || stringCutted == "JPG" || stringCutted == "jpeg" || stringCutted == "JPEG")
                            {
                                if (FileBuffer != null)
                                {
                                    Response.ContentType = "image/jpeg";
                                    Response.AddHeader("content-length", FileBuffer.Length.ToString());
                                    Response.BinaryWrite(FileBuffer);
                                    Response.End();
                                }
                            }
                        }
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "displayalertmessage", "alert('Success');", true);
                    }
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "displayalertmessage", "alert('Fail to Open File');", true);
                }
            }
        }

使用Elasticsearch 5.1.1

2 个答案:

答案 0 :(得分:3)

如果您尝试更改network.host

中的elasticsearch.yml标记,该怎么办?
network.host:0.0.0.0

network.bind_host默认为 network.host 的值。如果是您尝试映射的本地IP地址,则不应该是127.0.0.1

答案 1 :(得分:0)

如果你只想在127.0.0.1上使用它,你有几个选择。例如,您可以使用以下之一:

network.host: [ "_local:ipv4_" ]
network.host: [ "_lo:ipv4_" ]

如果它只是您要指定的IPv4版本,您可以选择更明确地指定其中一些:

"_local_"

根据我的经验,"_lo_"大部分时间都在工作。我在VMWare ESX环境中运行VM时遇到的"_lo_"版本。目前还不清楚为什么这是必需的,但"_site_"版本运行良好。

还有其他特殊的视图,例如"_global_"admin.auth().updateUser(...)

参考