AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题

问题[linux](dba)

Martin Hope
randominstanceOfLivingThing
Asked: 2023-04-26 15:01:17 +0800 CST

在 lsof 命令的上下文中如何使用 cassandra 9042 端口?

  • 6

我正在尝试确定谁在我的环境中连接到 cassandra 实例。机器有 ip 172.31.44.23。我运行命令sudo lsof -i -n -P | grep 9042 | grep ESTABLISHED | awk ' {print $9}'

我得到下面的输出

172.31.44.23:38082->172.31.44.23:9042
127.0.0.1:50067->127.0.0.1:9042
127.0.0.1:50068->127.0.0.1:9042
127.0.0.1:50069->127.0.0.1:9042
127.0.0.1:50070->127.0.0.1:9042
172.31.44.23:38087->172.31.44.23:9042
172.31.44.23:9042->172.31.112.109:34750
172.31.44.23:9042->172.31.114.115:42386
172.31.44.23:9042->172.31.107.171:20093
172.31.44.23:9042->172.31.107.171:53102
172.31.44.23:9042->172.31.44.23:38082
127.0.0.1:9042->127.0.0.1:50067
127.0.0.1:9042->127.0.0.1:50068
127.0.0.1:9042->127.0.0.1:50069
172.31.44.23:9042->172.31.114.23:35858
172.31.44.23:9042->172.31.114.115:42388
127.0.0.1:9042->127.0.0.1:50070
172.31.44.23:9042->172.31.44.23:38087

我知道连接格式适用local_address:port -> remote_address:port于带有标志的 lsof。我如何理解 9042 端口是如何用于服务本机传输请求的?

linux
  • 2 个回答
  • 16 Views
Martin Hope
W. Kessler
Asked: 2023-04-06 03:06:02 +0800 CST

为远程连接配置 Postgresql 的问题:'Postgresql.service 的作业失败'

  • 6
这个问题是从 Stack Overflow迁移过来的,因为它可以在 Database Administrators Stack Exchange 上回答。15 天前迁移 。

我正在尝试为 SLES15 环境中的远程连接配置 Postgresql 14.7。我一直在遵循 Postgres 的Zypper 安装说明并补充了这些说明,因为我注意到两者之间的目录约定之间存在一些细微差别。看来我可以启动 postgresql 服务,但是在更新 conf 文件以接受远程连接后它失败了。

初始化 Postgresql 服务并sudo systemctl start postgresql确保它处于活动状态后,我编辑了此处和此处postgres.conf提到的和“pg_hba.conf”文件。

在postgresql.conf我添加的文件中:

#listen_addresses = 'localhost'
listen_addresses = '*'

我补充说pg_hba.conf:

# TYPE  DATABASE    USER    ADDRESS     METHOD
host    all         all     0.0.0.0/0       md5
host    all             all     :/0             md5

然后我重新启动服务并sudo systemctl restart postgresql收到以下错误:

PostgreSQL.service 的作业失败,因为控制进程退出并显示错误代码。
有关详细信息,请参阅“systemctl status postgresql.service”和“journalctl -xeu postgresql.service”`

的输出journalctl -xeu postgresql.service给出:

journalctl -xeu postgresql.service
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A stop job for unit postgresql.service has begun execution.
░░ 
░░ The job identifier is 62101.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: postgresql.service: Deactivated successfully.
░░ Subject: Unit succeeded
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit postgresql.service has successfully entered the 'dead' state.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: Stopped PostgreSQL database server.
░░ Subject: A stop job for unit postgresql.service has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A stop job for unit postgresql.service has finished.
░░ 
░░ The job identifier is 62101 and the job result is done.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: Starting PostgreSQL database server...
░░ Subject: A start job for unit postgresql.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has begun execution.
░░ 
░░ The job identifier is 62101.
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66239]: 2023-04-05 15:19:15.322 EDT   [66239]LOG:  redirecting log output to logging collector process
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66239]: 2023-04-05 15:19:15.322 EDT   [66239]HINT:  Future log output will appear in directory "log".
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66237]: pg_ctl: could not start server
Apr 05 15:19:15 sph-gcmc2 postgresql-script[66237]: Examine the log output.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit postgresql.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: postgresql.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit postgresql.service has entered the 'failed' state with result 'exit-code'.
Apr 05 15:19:15 sph-gcmc2 systemd[1]: Failed to start PostgreSQL database server.
░░ Subject: A start job for unit postgresql.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has finished with a failure.
░░ 
░░ The job identifier is 62101 and the job result is failed.
lines 387-440/440 (END)

在这一点上,我还没有尝试更新防火墙规则,这是工作流中的下一步,因为我的更改导致服务崩溃。

我的目标是使用 PostgreSQL 数据库作为 ESRI 企业地理数据库实例的主干,但数据库设置让我感到困惑。

linux
  • 2 个回答
  • 43 Views
Martin Hope
Rafael Chielle
Asked: 2023-03-08 04:12:54 +0800 CST

PostgreSQL 使用大量内存

  • 5
这个问题是从 Stack Overflow迁移过来的,因为它可以在 Database Administrators Stack Exchange 上回答。13 天前迁移 。

当执行包含 WITH 和超过一千个 UNION ALL 的查询时,PostgreSQL 版本 14 或更高版本使用所有服务器内存,直到它进入恢复模式。在版本 11 的测试中,不会发生此行为。

WITH DADOS as (
SELECT   
             CAST( 37959.0 as NUMERIC(9, 0)) id ,
             CAST( 1.0 as NUMERIC(9, 0)) emp,
             CAST( 12884.0 as NUMERIC(9, 0)) pro ,
             CAST( 7.891097087431E12 as NUMERIC(18, 0)) gtin,
             to_timestamp( '2023-03-07 12:48:00' , 'YYYY-MM-DD HH24:MI:SS') data3,
             CAST( 0.79 as NUMERIC(18, 8)) preco ,
             CAST( 10.0 as NUMERIC(18, 8)) valor1 ,
             CAST( 0.0 as NUMERIC(18, 8)) preco,
             CAST( 0.0 as NUMERIC(18, 8)) valor3,
             CAST( '1' as NUMERIC(1, 0)) flag ,
             0,
             current_timestamp,
             current_timestamp,
             CAST( 'USER' as varchar(255)) usr,
             to_timestamp( '2023-03-07 23:59:00' , 'YYYY-MM-DD HH24:MI:SS') data1,
             CAST( 9.0 as NUMERIC(18, 8)) codigo2,
             CAST( 5.0 as NUMERIC(1)) opt,
             to_timestamp( '2023-03-07 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') data2,
             CAST( '2' as NUMERIC(1)) codigo3
UNION ALL

... over 2k  unions all..
 
SELECT   
             CAST( 37975.0 as NUMERIC(9, 0)) id ,
             CAST( 1.0 as NUMERIC(9, 0)) emp,
             CAST( 29121.0 as NUMERIC(9, 0)) pro ,
             CAST( 7.896011105178E12 as NUMERIC(18, 0)) gtin,
             to_timestamp( '2023-03-07 12:48:00' , 'YYYY-MM-DD HH24:MI:SS') data3,
             CAST( 1.98 as NUMERIC(18, 8)) preco ,
             CAST( 10.0 as NUMERIC(18, 8)) valor1 ,
             CAST( 0.0 as NUMERIC(18, 8)) preco,
             CAST( 0.0 as NUMERIC(18, 8)) valor3,
             CAST( '1' as NUMERIC(1, 0)) flag ,
             0,
             current_timestamp,
             current_timestamp,
             CAST( 'USER' as varchar(255)) usr,
             to_timestamp( '2023-03-07 23:59:00' , 'YYYY-MM-DD HH24:MI:SS') data1,
             CAST( 9.0 as NUMERIC(18, 8)) codigo2,
             CAST( 5.0 as NUMERIC(1)) opt,
             to_timestamp( '2023-03-07 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') data2,
             CAST( '2' as NUMERIC(1)) codigo3 
             )
        select
    *
from
    dados
linux
  • 1 个回答
  • 112 Views
Martin Hope
Dmitrij
Asked: 2023-02-22 20:29:48 +0800 CST

Apache Cassandra 3.11.2 无法启动 Centos 7

  • 6

我试图在 Centos 7 上启动 Apache Cassandra 3.11.2,但出现错误异常:

ERROR [main] 2023-02-22 11:19:03,067 NativeLibraryLinux.java:64 - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /tmp/jna-1073564104/jna8760917299733827163.tmp: /tmp/jna-1073564104/jna8760917299733827163.tmp: failed to map segment from shared object: Operation not permitted
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1820)
        at java.lang.Runtime.load0(Runtime.java:782)
        at java.lang.System.load(System.java:1098)
        at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:851)
        at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:826)
        at com.sun.jna.Native.<clinit>(Native.java:140)
        at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:84)
        at org.apache.cassandra.utils.NativeLibraryLinux.<clinit>(NativeLibraryLinux.java:55)
        at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:95)
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:212)
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:633)
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786)
WARN  [main] 2023-02-22 11:19:03,067 StartupChecks.java:136 - jemalloc shared library could not be preloaded to speed up memory allocations
INFO  [main] 2023-02-22 11:19:03,067 StartupChecks.java:176 - JMX is enabled to receive remote connections on port: 7199
ERROR [main] 2023-02-22 11:19:03,068 CassandraDaemon.java:803 - The native library could not be initialized properly.

我该如何解决 ?

linux
  • 2 个回答
  • 26 Views
Martin Hope
fa__
Asked: 2022-09-20 08:08:07 +0800 CST

Postgresql 内存使用调用 OOM 杀手

  • 0
这个问题是从 Stack Overflow迁移过来的,因为它可以在 Database Administrators Stack Exchange 上得到回答。 29 天前迁移 。

我在具有 512 MB RAM 和 8 GB 磁盘的设备上使用 Debian 9。我已经安装了带有扩展 TimescaleDB 1.7.1 的 PostgreSQL 9.6.22。PostgreSQL内存相关参数如下:

shared_buffers = 128MB                  # min 128kB
#temp_buffers = 8MB                     # min 800kB
#work_mem = 4MB                         # min 64kB
#maintenance_work_mem = 64MB            # min 1MB
#autovacuum_work_mem = -1               # min 1MB, or -1 to use maintenance_work_mem
dynamic_shared_memory_type = posix      # the default is the first option
                                        # use none to disable dynamic shared memory
max_connections = 13                    # (change requires restart)
#superuser_reserved_connections = 3     # (change requires restart)

最近OOM杀手出现了,看来PostgreSQL是占内存最多的:

 postgres invoked oom-killer: gfp_mask=0x26084c0, order=0, oom_score_adj=0
 postgres cpuset=/ mems_allowed=0
 CPU: 0 PID: 11632 Comm: postgres Not tainted 4.4.0-cip #1
 Hardware name: Generic AM33XX (Flattened Device Tree)
 [<c00133d0>] (unwind_backtrace) from [<c0011cdc>] (show_stack+0x10/0x14)
 [<c0011cdc>] (show_stack) from [<c00dca94>] (dump_header+0x4c/0x180)
 [<c00dca94>] (dump_header) from [<c00a38e4>] (oom_kill_process+0x6c/0x39c)
 [<c00a38e4>] (oom_kill_process) from [<c00a3e54>] (out_of_memory+0x1d8/0x2fc)
 [<c00a3e54>] (out_of_memory) from [<c00a7ecc>] (__alloc_pages_nodemask+0x830/0x89c)
 [<c00a7ecc>] (__alloc_pages_nodemask) from [<c00c012c>] (__pte_alloc+0x20/0x1b0)
 [<c00c012c>] (__pte_alloc) from [<c00c209c>] (handle_mm_fault+0x224/0xc80)
 [<c00c209c>] (handle_mm_fault) from [<c04be4b0>] (do_page_fault+0x20c/0x35c)
 [<c04be4b0>] (do_page_fault) from [<c000923c>] (do_DataAbort+0x38/0xb8)
 [<c000923c>] (do_DataAbort) from [<c04bdebc>] (__dabt_usr+0x3c/0x40)
 Exception stack(0xdb95bfb0 to 0xdb95bff8)
 bfa0:                                     aaf9a000 00000000 00101002 aaf9a008
 bfc0: b6a5d7a4 00101000 00098dd6 b6a5d7d4 00100008 b6a5d000 000001ff b6a4185c
 bfe0: 000000c0 bed9f978 b6a052d7 b69c444c 40070030 ffffffff
 Mem-Info:
 active_anon:113550 inactive_anon:651 isolated_anon:0
                              active_file:69 inactive_file:126 isolated_file:0
                              unevictable:0 dirty:0 writeback:0 unstable:0
                              slab_reclaimable:1250 slab_unreclaimable:2180
                              mapped:34529 shmem:35279 pagetables:         free:8083 free_pcp:0 free_cma:2861
 Normal free:32332kB min:16384kB low:20480kB high:24576kB active_anon:454200kB inactive_anon:2604kB active_file:276kB inactive_file:504kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:524288kB managed:511816kB mlocked:0kB dirty:0kB writeback:0kB mapped:138116kB shmem:141116kB slab_reclaimable:5000kB slab_unreclaimable:8720kB kernel_stack:1136kB pagetables:4776kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:11444kB writeback_tmp:0kB pages_scanned:4960 all_unreclaimable? yes
 lowmem_reserve[]: 0 0 0
 Normal: 989*4kB (UMEHC) 397*8kB (UMEH) 215*16kB (UMEHC) 138*32kB (UMEHC) 67*64kB (UEH) 12*128kB (UEC) 1*256kB (U) 0*512kB 1*1024kB (C) 1*2048kB (C) 2*4096kB (C) 0*8192kB = 32332kB
 35474 total pagecache pages
 0 pages in swap cache
 Swap cache stats: add 0, delete 0, find 0/0
 Free swap  = 0kB
 Total swap = 0kB
 131072 pages RAM
 0 pages HighMem/MovableOnly
 3118 pages reserved
 4096 pages cma reserved
 [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name
 [  220]     0   220    36222      113      64       0        0             0 systemd-journal
 [  247]     0   247     3154      103       7       0        0         -1000 systemd-udevd
 [  352]  1000   352     4778       31       6       0        0             0 custom-process
 [  353]  1000   353     6572       35       5       0        0             0 custom-process2
 [  356]  1000   356     4778       46       5       0        0             0 custom-process3
 [  358]     0   358     1163       55       5       0        0             0 cron
 [  368]  1000   368     4778       32       7       0        0             0 custom-process4
 [  377]   107   377     1332      104       6       0        0          -900 dbus-daemon
 [  385]     0   385     1795      212       7       0        0             0 openvpn
 [  389]  1000   389     5477       55       7       0        0             0 custom-process5
 [  405]     0   405     1524      105       5       0        0             0 systemd-logind
 [  408]  1000   408     7084       40       8       0        0             0 custom-process6
 [  412]     0   412     1100       54       6       0        0             0 cgmanager
 [  416]  1000   416     6572       41       6       0        0             0 custom-process7
 [  422]     0   422     2488       33       3       0        0             0 custom-process8
 [  526]   109   526    47120     2045      22       0        0          -900 postgres
 [  530]   109   530    47145    32270      84       0        0             0 postgres
 [  531]   109   531    47120      538      18       0        0             0 postgres
 [  532]   109   532    47120     1343      19       0        0             0 postgres
 [  533]   109   533    47206      542      21       0        0             0 postgres
 [  534]   109   534    12158      325      16       0        0             0 postgres
 [  535]   109   535    47187      500      20       0        0             0 postgres
 [  537]   109   537    96668    51046     124       0        0             0 postgres
 [  564]     0   564     1315      174       6       0        0             0 dhclient
 [  641]     0   641     2125      134       7       0        0         -1000 sshd
 [  643]     0   643      923       29       5       0        0             0 agetty
 [  646]     0   646      868       29       5       0        0             0 agetty
 [  675]   105   675     1993      408       7       0        0             0 ntpd
 [29365]     0 29365    10566      333      15       0        0             0 packagekitd
 [29371]     0 29371     9412      435      14       0        0             0 polkitd
 [29655]     0 29655    10825      268      13       0        0             0 nginx
 [29656]    33 29656    10876      319      13       0        0             0 nginx
 [19701]  1000 19701    42241     7379     114       0        0             0 node
 [11625]   109 11625    47909    17171      85       0        0             0 postgres
 [11629]   109 11629    47775    15420      84       0        0             0 postgres
 [11631]   109 11631    50664     6973      58       0        0             0 postgres
 [11632]   109 11632    50987     6972      58       0        0             0 postgres
 [11633]   109 11633    50986     6982      58       0        0             0 postgres
 [11634]   109 11634    50985     6986      58       0        0             0 postgres
 [11635]   109 11635    50987     6981      58       0        0             0 postgres
 [11636]   109 11636    50987     6981      58       0        0             0 postgres
 Out of memory: Kill process 537 (postgres) score 399 or sacrifice child
 Killed process 537 (postgres) total-vm:386672kB, anon-rss:19679

这是当时的 PostgreSQL 日志:

[526] LOG:  worker process: TimescaleDB Background Worker Scheduler (PID 537) was terminated by signal 9: Killed
[526] LOG:  terminating any other active server processes
[11629] postgres@db WARNING:  terminating connection because of crash of another server process
[11629] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11629] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11625] postgres@db WARNING:  terminating connection because of crash of another server process
[11625] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11625] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[533] WARNING:  terminating connection because of crash of another server process
[533] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another
 server process exited abnormally and possibly corrupted shared memory.
[533] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11632] postgres@db WARNING:  terminating connection because of crash of another server process
[11632] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11632] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11635] postgres@db WARNING:  terminating connection because of crash of another server process
[11635] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11635] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11631] postgres@db WARNING:  terminating connection because of crash of another server process
[11631] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11631] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11634] postgres@db WARNING:  terminating connection because of crash of another server process
[11634] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11634] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11633] postgres@db WARNING:  terminating connection because of crash of another server process
[11633] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11633] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[11636] postgres@db WARNING:  terminating connection because of crash of another server process
[11636] postgres@db DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit,
 because another server process exited abnormally and possibly corrupted shared memory.
[11636] postgres@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.
[526] LOG:  all server processes terminated; reinitializing
[11637] LOG:  database system was interrupted; last known up at 2022-09-12 21:47:45 CEST
[11637] LOG:  database system was not properly shut down; automatic recovery in progress
[11637] LOG:  redo starts at 1C/32C6E978
[11637] LOG:  invalid record length at 1C/32D041F8: wanted 24, got 0
[11637] LOG:  redo done at 1C/32D041D0
[11637] LOG:  last completed transaction was at log time 2022-09-12 21:50:23.799706+02
[11637] LOG:  MultiXact member wraparound protections are now enabled
[11641] LOG:  autovacuum launcher started
[526] LOG:  database system is ready to accept connections
[11643] LOG:  TimescaleDB background worker launcher connected to shared catalogs

我知道有过度使用调整可用,并且我的应用程序可能存在调用 PostgreSQL 的潜在问题,但我想了解 PostgreSQL 对内存的使用。我试图了解 OOM Killer 输出和 PostgreSQL 内存相关参数,但我有几个疑问:

  • PostgreSQl 的最大进程数是多少?我认为它对应于最大连接数(max_connections + superuser_reserved_connections)。但是,在这种情况下,这个限制加起来是 13 个,而有 16 个 postgres 进程。
  • 根据此处和此处描述的 OOM 杀手输出的解释,实际使用的 RAM 是rss值的总和。但是,在这种情况下,总和为 187604 页≈730 MB,这超过了设备中的总 RAM。
  • PostgreSQL 可以使用的最大内存是多少?根据这个答案,max RAM = shared_buffers + (temp_buffers + work_mem) * max_connections。在这种情况下,128 + (8+4)*10 = 248MB。但是,OOM​​ Killer 输出与此假设不匹配。postgres 进程的总 rss 约为 690MB,比它应该的要多得多,甚至比设备中的总 RAM 还要多。
  • 我应该考虑其他任何 PostgreSQL 参数吗?
postgresql linux
  • 1 个回答
  • 83 Views
Martin Hope
LetMeSOThat4U
Asked: 2022-09-13 08:23:17 +0800 CST

在 Linux 和 Windows 上查找 Sybase DB (ASE) 主目录的可靠方法

  • 0

如果有的话,我需要编写一个脚本来查找系统上的 Sybase 安装。

为了测试,我在 CentOS 系统上安装了 ASE 16,但安装程序显然基于 InstallAnywhere (Java)。

这显然是一种安装方法,我不确定是否有更多安装 ASE 的方法,比如安装 RPM 包。

无论如何,SYBASE.sh在包含主目录的 ASE 安装中,有这个用于获取环境变量的脚本。这显然是 catch-22 的情况:为了找到这个脚本,我需要知道 ASE 的主目录。

是的,我可以在通常的位置(例如/sysdba或)进行检查/opt/sap。当然,交互式安装程序显然允许将 ASE 安装在任何地方,所以这还不够好。

找到它的最佳方法是什么?我愿意做一些事情,比如跟踪正在运行的进程到他们的可执行文件等,只要能帮助我找到 ASE 的安装位置。由于某些原因,我什至不会在它运行时才找到它。

我可以以 root 或管理员身份运行脚本,这没有问题。

windows linux
  • 1 个回答
  • 21 Views
Martin Hope
Juzer Shakir
Asked: 2022-09-10 00:42:41 +0800 CST

PostgreSQL 14 服务器不在 Ubuntu 22.04 上本地运行

  • 0
这个问题是从 Stack Overflow迁移过来的,因为它可以在 Database Administrators Stack Exchange 上得到回答。 上个月迁移 。

所以昨天我将我的 Ubuntu 操作系统从 20 LTS 更新到 22.04 LTS 并从这个源安装了 PostgreSQL 。运行,psql -V我得到了这个:

(PostgreSQL) 14.5 (Ubuntu 14.5-1.pgdg22.04+1)

使用以下内容初始化 postgresql:

$ service postgresql initdb
$ systemctl enable postgresql
$ systemctl start postgresql

运行psql命令时,我收到以下错误:

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

同样在运行时pg_lsclusters,我得到以下信息:

Ver Cluster Port Status Owner Data directory Log file

当导航到 postgresql 目录时ls etc/postgresql/,它里面没有文件或文件夹。

我也安装了postgresql-contrib,正如这个来源中提到的。我查找此源的原因是我想初始化 Postgres 服务器,所以我按照其中提到的命令进行操作。

$ sudo systemctl start postgresql.service
$ sudo -i -u postgres
postgres@ror:~$ createuser --interactive
Enter name of role to add: juzershakir
Shall the new role be a superuser? (y/n) y

获取以下错误消息:

createuser: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

当我检查 PostgreSQL 服务的状态时:

$ sudo systemctl status postgresql.service
postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2022-09-09 12:58:06 IST; 49min ago
    Process: 10493 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 10493 (code=exited, status=0/SUCCESS)
        CPU: 1ms

Sep 09 12:58:06 ror systemd[1]: Starting PostgreSQL RDBMS...
Sep 09 12:58:06 ror systemd[1]: Finished PostgreSQL RDBMS.

我不是这方面的专家,但从这个错误消息来看,服务似乎启动然后关闭。为什么会这样?我错过了哪些步骤?


我已经提到的在线资源:

  • PostgreSQL:为什么 psql 无法连接到服务器?

  • Psql 无法连接到服务器:没有这样的文件或目录,5432 错误?

  • 无法连接到服务器:“/var/run/postgresql/.s.PGSQL.5432”?

  • psql:错误:连接到套接字“/tmp/.s.PGSQL.5432”上的服务器失败:没有这样的文件或目录

我尝试过的命令:

$ sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
$ sudo service postgresql start --force
$ cat /var/run/postgresql/.s.PGSQL.5432                                                                                                                                   
cat: /var/run/postgresql/.s.PGSQL.5432: No such file or directory
$cd /tmp
l
   rwxrwxrwt   25   root       root         24 KiB   Fri Sep  9 13:58:14 2022    ./
   rwxr-xr-x   20   root       root          4 KiB   Wed Dec 22 11:15:40 2021    ../
   rwx------    2   jsubuntu   jsubuntu      4 KiB   Fri Sep  9 12:32:07 2022    .com.google.Chrome.o8bjs4/
   rwxrwxrwt    2   root       root          4 KiB   Fri Sep  9 12:29:41 2022    .font-unix/
   rwxrwxrwt    2   root       root          4 KiB   Fri Sep  9 12:30:15 2022    .ICE-unix/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:14 2022    snap.canonical-livepatch/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:15 2022    snap.snapd-desktop-integration/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:16 2022    snap.snap-store/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:13 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-apache2.service-ZrAICM/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:14 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-bluetooth.service-tGJABQ/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:17 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-colord.service-En9sFA/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:18 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-fwupd.service-okItPb/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:13 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-ModemManager.service-KbJJ4J/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:13 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-power-profiles-daemon.service-nguChr/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:13 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-redis-server.service-EaKdzC/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:13 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-switcheroo-control.service-hLF6lp/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:13 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-systemd-logind.service-jMNsHm/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:29:41 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-systemd-oomd.service-ZtaPW4/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:29:41 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-systemd-resolved.service-gHZzR9/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:29:41 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-systemd-timesyncd.service-Ycbvmk/
   rwx------    3   root       root          4 KiB   Fri Sep  9 12:30:16 2022    systemd-private-64f08d0504e04acfb3259292fa13580c-upower.service-PBPl2C/
   rwxrwxrwt    2   root       root          4 KiB   Fri Sep  9 12:29:41 2022    .Test-unix/
   rwx------    2   jsubuntu   jsubuntu      4 KiB   Fri Sep  9 12:30:18 2022    tracker-extract-3-files.1000/
   rwxrwxrwt    2   root       root          4 KiB   Fri Sep  9 12:30:15 2022    .X11-unix/
   rwxrwxrwt    2   root       root          4 KiB   Fri Sep  9 12:29:41 2022    .XIM-unix/
   r--r--r--    1   jsubuntu   jsubuntu     11 B     Fri Sep  9 12:30:15 2022    .X0-lock 
   r--r--r--    1   jsubuntu   jsubuntu     11 B     Fri Sep  9 12:30:15 2022    .X1-lock 
$ sudo nano /etc/postgresql/14/main/pg_ident.conf
(Directory doesnt exist)
linux postgresql-14
  • 1 个回答
  • 252 Views
Martin Hope
machineghost
Asked: 2022-08-01 15:00:30 +0800 CST

无法使用新创建的用户运行 Postgres createdb 命令

  • 0

精简版:

我得到:

错误:连接到套接字“/var/run/postgresql/.s.PGSQL.5432”上的服务器失败:致命:用户“admin”的对等身份验证失败

当我尝试createdb --username admin --password mynewdb......但我在 Linux 和 PostgreSQL 中都创建了“管理员”用户,所以我不明白为什么我不能使用它们。

长版:

我正在尝试创建一个“管理员”用户来在全新的 Ubuntu/AWS 机器上运行 SQL。我创建了用户

$ sudo useradd -g admin admin

然后我使用以下方法设置他们的密码:

$ sudo passwd admin

我知道密码设置正确,因为我可以通过输入密码切换到“管理员”用户,其中:

$ su - admin

我还为用户创建了一个数据库角色,其中:

CREATE ROLE admin WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD 'samepassword';

我可以看到用户是用\du(从内部psql)创建的:

 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 admin     | Superuser, Create role, Create DB                          | {}

此外,我可以从我的pg_hba.conf文件中确认 Postgres 应该使用该用户的“peer”(即系统)密码:

local   all             all                                     peer

为了安全起见,我重新启动了 Postgres:

sudo service postgresql restart

但是,尽管有上述所有情况,当我尝试使用该“管理员”用户创建一个新数据库时,系统createdb会提示我输入密码两次,然后失败:

$ createdb --username admin --password mynewdb
Password: 
Password: 
createdb: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed:
FATAL:  Peer authentication failed for user "admin"

我已经尝试阅读有关此错误的其他 SO 答案,但它们都建议我尝试过的事情(即更改pg_hba.conf、重新启动 Postgres 等)但是,我有点像 Postgres 新手,所以如果有人有任何进一步的建议我很想听听他们的意见。

postgresql linux
  • 1 个回答
  • 138 Views
Martin Hope
SomethingSomething
Asked: 2022-06-29 07:12:34 +0800 CST

是否可以从 Linux 实例访问 Windows MSSQL 服务器?

  • -3

我正在尝试评估在非常多的 Windows 环境中使用 Linux 来执行 bash/脚本实用程序的可行性。从我能找到的文档中,ubuntu 访问是可能的,但它似乎来自 SQL DB 在 Linux 中的安装位置,而不是在 Windows 中。是否有任何障碍可以通过 Linux 或 Windows-Subsystem-Linux 设置此访问权限?

sql-server linux
  • 1 个回答
  • 55 Views
Martin Hope
Bruce Murdock
Asked: 2022-01-07 15:31:57 +0800 CST

尝试在我的 linux 系统上导入 sql 文件时权限被拒绝

  • 1

我正在尝试将一个表导入到我已经作为 postgres 超级用户创建的名为“test”的数据库中。该文件(即表)位于已安装的驱动器/文件系统中。

*我已登录到 postgres 用户。其他用户对该文件具有读、写和执行权限。

当我使用以下命令时

\i '/run/media/qazizarifulislam/Windows_files/Work/RA/learning-postgres/person.sql'

我收到错误 - /run/media/qazizarifulislam/Windows_files/Work/RA/learning-postgres/person.sql: Permission denied

在哪里,

  • qazizarifulislam 是我的用户名
  • Windows_files 是文件系统(它是 NFTS,而不是外部 HDD 或 SDD)
  • 其余部分只是子文件夹。
  • person.sql 是一个文件,其中包含创建表的行,然后具有将记录插入表中的查询。(预览如下图)

在此处输入图像描述

我该如何解决这个问题/导入表格?

postgresql linux
  • 3 个回答
  • 604 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve