我正在尝试使用knex连接到我的本地postgres数据库,但我一直收到此错误。
while(inFile >> value)
{
istringstream iss(value);
string line;
while(getline(iss, line))
{
size_t prev = 0, pos;
while ((pos = line.find_first_of("|:", prev)) != string::npos)
{
if (pos > prev)
{
vect.push_back(line.substr(prev, pos-prev));
}
prev = pos + 1;
}
if (prev < line.length())
{
vect.push_back(line.substr(prev, string::npos));
}
}
}
其他信息: 我也通过localhost:3000上的webpack运行React前端,它通过webpack服务器上的代理设置向8080发送http请求,但这似乎正在运行。
我还在localhost:9200上运行了弹性搜索,这似乎也在蠢蠢欲动。
答案 0 :(得分:0)
问题是我安装了不正确的postgres版本。我重新安装了postgres,不再有问题了。
答案 1 :(得分:-1)
另一种更快的方法是连接到本地数据库是使用AF_UNIX套接字。您必须为将托管该应用程序的Linux用户授予访问权限:
development:
connection: {
host: '/var/run/postgresql', // On Debian it is this one, check your distro
database: 'database_name'
},
这种访问测量速度比通过AF_INET(TCP / IP)套接字快30%。
这是一篇关于该文章的旧文章:Performance of UNIX sockets vs TCP sockets