我有一台运行 Cassandra 的物理服务器。鉴于 Cassandra 在胖节点上表现不佳,哪种策略更好:
- 在服务器上运行单个大型节点(将所有资源分配给该实例)
- 在服务器上运行多个较小的节点并模拟集群(将资源拆分到实例)
提前致谢。
我有一台运行 Cassandra 的物理服务器。鉴于 Cassandra 在胖节点上表现不佳,哪种策略更好:
提前致谢。
test=# create table r (id serial primary key, x int, y int);
CREATE TABLE
test=# insert into r (x, y) select random() * 1000, random() * 1000 from generate_series(0, 1000000);
INSERT 0 1000001
test=#
test=# create index r_x_idx on r using btree (x);
CREATE INDEX
test=# cluster r using r_x_idx ;
CLUSTER
test=# select * from r limit 5;
id | x | y
------+---+-----
79 | 0 | 556
5997 | 0 | 774
6104 | 0 | 75
6937 | 0 | 818
7859 | 0 | 598
(5 rows)
test=# select * from r limit 5 offset 10000;
id | x | y
--------+----+-----
483314 | 10 | 842
484136 | 10 | 741
484568 | 10 | 729
488499 | 10 | 311
489022 | 10 | 613
(5 rows)
test=# select * from r limit 5;
id | x | y
--------+---+-----
330361 | 9 | 614
330928 | 9 | 48
331658 | 9 | 712
332175 | 9 | 448
332818 | 9 | 920
(5 rows)
如上所示,我创建了表r
,然后在列上创建了一个 b+tree 索引x
,然后使用该索引对表进行聚类。正如预期的那样,当我运行时,select * from r limit 5;
我得到了具有最小值的记录x
,因为记录的物理顺序现在基于x
列(更准确地说,基于列上的 b+tree 索引x
)。但是运行后select * from r limit 5 offset 10000;
,记录的顺序发生了变化,没有任何插入。有人可以解释这种行为吗?
根据文件:
postmaster 是 PostgreSQL 多用户数据库服务器。客户端应用程序要访问数据库,需要通过网络或本地连接到正在运行的 postmaster。postmaster 随后启动一个单独的服务器进程(“postgres”)来处理连接。postmaster 还管理服务器进程之间的通信。
我无法完全理解多用户的含义,也没有找到任何解释。有人能向我解释一下 postmaster 的职责是什么吗?这是否类似于多个 postgres 服务器的负载平衡器?