使用 sudo 后 EventStoreDB v5 无法 运行

EventStoreDB v5 Fail to run after using sudo

我通常 运行 带有 eventstore --run-projections=System 的 eventstore 但试图 运行 查询,macos 抛出安全投诉:“libjs1.dylib” cannot be opened because the developer cannot be verified.

所以我运行sudo eventstore --run-projections=System。这没有解决问题。我进入系统首选项 > 安全 > 常规并授予对 libjs1.dylib 和查询 运行 的访问权限,但没有返回任何值。

我意识到事件存储中的所有数据都不见了。

我想也许是因为 sudo?我 运行 没有 sudo 现在我得到这个错误:

[34307,01,18:12:12.463]
“ES VERSION:” “5.0.5.0” (“HEAD”/“b92e517ced0aada066f9f525e02082cdbdb34d7f”, “Fri, 13 Sep 2019 16:29:49 +0200”)
[34307,01,18:12:12.487] “OS:” MacOS (Unix 19.5.0.0)
[34307,01,18:12:12.494] “RUNTIME:” “5.16.0.220 (2018-06/bb3ae37d71a Fri Nov 16 17:12:11 EST 2018)” (64-bit)
[34307,01,18:12:12.494] “GC:” “2 GENERATIONS”
[34307,01,18:12:12.494] “LOGS:” “/var/log/eventstore”
MODIFIED OPTIONS:

    RUN PROJECTIONS:          System (Command Line)
DEFAULT OPTIONS:

    HELP:                     False (<DEFAULT>)
    VERSION:                  False (<DEFAULT>)
    LOG:                      /var/log/eventstore (<DEFAULT>)
    CONFIG:                   <empty> (<DEFAULT>)
    DEFINES:                  <empty> (<DEFAULT>)
    WHAT IF:                  False (<DEFAULT>)
    START STANDARD PROJECTIONS: False (<DEFAULT>)
    DISABLE HTTP CACHING:     False (<DEFAULT>)
    MONO MIN THREADPOOL SIZE: 10 (<DEFAULT>)
    INT IP:                   127.0.0.1 (<DEFAULT>)
    EXT IP:                   127.0.0.1 (<DEFAULT>)
    INT HTTP PORT:            2112 (<DEFAULT>)
    EXT HTTP PORT:            2113 (<DEFAULT>)
    INT TCP PORT:             1112 (<DEFAULT>)
    INT SECURE TCP PORT:      0 (<DEFAULT>)
    EXT TCP PORT:             1113 (<DEFAULT>)
    EXT SECURE TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    EXT SECURE TCP PORT:      0 (<DEFAULT>)
    EXT IP ADVERTISE AS:      <empty> (<DEFAULT>)
    EXT TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    EXT HTTP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT IP ADVERTISE AS:      <empty> (<DEFAULT>)
    INT SECURE TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT HTTP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT TCP HEARTBEAT TIMEOUT: 700 (<DEFAULT>)
    EXT TCP HEARTBEAT TIMEOUT: 1000 (<DEFAULT>)
    INT TCP HEARTBEAT INTERVAL: 700 (<DEFAULT>)
    EXT TCP HEARTBEAT INTERVAL: 2000 (<DEFAULT>)
    GOSSIP ON SINGLE NODE:    False (<DEFAULT>)
    CONNECTION PENDING SEND BYTES THRESHOLD: 10485760 (<DEFAULT>)
    CONNECTION QUEUE SIZE THRESHOLD: 50000 (<DEFAULT>)
    FORCE:                    False (<DEFAULT>)
    CLUSTER SIZE:             1 (<DEFAULT>)
    NODE PRIORITY:            0 (<DEFAULT>)
    MIN FLUSH DELAY MS:       2 (<DEFAULT>)
    COMMIT COUNT:             -1 (<DEFAULT>)
    PREPARE COUNT:            -1 (<DEFAULT>)
    ADMIN ON EXT:             True (<DEFAULT>)
    STATS ON EXT:             True (<DEFAULT>)
    GOSSIP ON EXT:            True (<DEFAULT>)
    DISABLE SCAVENGE MERGING: False (<DEFAULT>)
    SCAVENGE HISTORY MAX AGE: 30 (<DEFAULT>)
    DISCOVER VIA DNS:         True (<DEFAULT>)
    CLUSTER DNS:              fake.dns (<DEFAULT>)
    CLUSTER GOSSIP PORT:      30777 (<DEFAULT>)
    GOSSIP SEED:              <empty> (<DEFAULT>)
    STATS PERIOD SEC:         30 (<DEFAULT>)
    CACHED CHUNKS:            -1 (<DEFAULT>)
    READER THREADS COUNT:     4 (<DEFAULT>)
    CHUNKS CACHE SIZE:        536871424 (<DEFAULT>)
    MAX MEM TABLE SIZE:       1000000 (<DEFAULT>)
    HASH COLLISION READ LIMIT: 100 (<DEFAULT>)
    DB:                       /var/lib/eventstore (<DEFAULT>)
    INDEX:                    <empty> (<DEFAULT>)
    MEM DB:                   False (<DEFAULT>)
    SKIP DB VERIFY:           False (<DEFAULT>)
    WRITE THROUGH:            False (<DEFAULT>)
    UNBUFFERED:               False (<DEFAULT>)
    CHUNK INITIAL READER COUNT: 5 (<DEFAULT>)
    PROJECTION THREADS:       3 (<DEFAULT>)
    WORKER THREADS:           5 (<DEFAULT>)
    PROJECTIONS QUERY EXPIRY: 5 (<DEFAULT>)
    FAULT OUT OF ORDER PROJECTIONS: False (<DEFAULT>)
    INT HTTP PREFIXES:        <empty> (<DEFAULT>)
    EXT HTTP PREFIXES:        <empty> (<DEFAULT>)
    ENABLE TRUSTED AUTH:      False (<DEFAULT>)
    ADD INTERFACE PREFIXES:   True (<DEFAULT>)
    CERTIFICATE STORE LOCATION: <empty> (<DEFAULT>)
    CERTIFICATE STORE NAME:   <empty> (<DEFAULT>)
    CERTIFICATE SUBJECT NAME: <empty> (<DEFAULT>)
    CERTIFICATE THUMBPRINT:   <empty> (<DEFAULT>)
    CERTIFICATE FILE:         <empty> (<DEFAULT>)
    CERTIFICATE PASSWORD:     <empty> (<DEFAULT>)
    USE INTERNAL SSL:         False (<DEFAULT>)
    DISABLE INSECURE TCP:     False (<DEFAULT>)
    SSL TARGET HOST:          n/a (<DEFAULT>)
    SSL VALIDATE SERVER:      True (<DEFAULT>)
    AUTHENTICATION TYPE:      internal (<DEFAULT>)
    AUTHENTICATION CONFIG:    <empty> (<DEFAULT>)
    DISABLE FIRST LEVEL HTTP AUTHORIZATION: False (<DEFAULT>)
    PREPARE TIMEOUT MS:       2000 (<DEFAULT>)
    COMMIT TIMEOUT MS:        2000 (<DEFAULT>)
    UNSAFE DISABLE FLUSH TO DISK: False (<DEFAULT>)
    BETTER ORDERING:          False (<DEFAULT>)
    UNSAFE IGNORE HARD DELETE: False (<DEFAULT>)
    SKIP INDEX VERIFY:        False (<DEFAULT>)
    INDEX CACHE DEPTH:        16 (<DEFAULT>)
    OPTIMIZE INDEX MERGE:     False (<DEFAULT>)
    GOSSIP INTERVAL MS:       1000 (<DEFAULT>)
    GOSSIP ALLOWED DIFFERENCE MS: 60000 (<DEFAULT>)
    GOSSIP TIMEOUT MS:        500 (<DEFAULT>)
    ENABLE HISTOGRAMS:        False (<DEFAULT>)
    LOG HTTP REQUESTS:        False (<DEFAULT>)
    LOG FAILED AUTHENTICATION ATTEMPTS: False (<DEFAULT>)
    ALWAYS KEEP SCAVENGED:    False (<DEFAULT>)
    SKIP INDEX SCAN ON READS: False (<DEFAULT>)
    REDUCE FILE CACHE PRESSURE: False (<DEFAULT>)
    INITIALIZATION THREADS:   1 (<DEFAULT>)
    STRUCTURED LOG:           True (<DEFAULT>)
    MAX AUTO MERGE INDEX LEVEL: 2147483647 (<DEFAULT>)
    WRITE STATS TO DB:        True (<DEFAULT>)
[34307,01,18:12:12.508] {“defaults”:{“Help”:“False”,“Version”:“False”,“Log”:"/var/log/eventstore",“Config”:"",“Defines”:“System.String[]”,“WhatIf”:“False”,“StartStandardProjections”:“False”,“DisableHTTPCaching”:“False”,“MonoMinThreadpoolSize”:“10”,“IntIp”:“127.0.0.1”,“ExtIp”:“127.0.0.1”,“IntHttpPort”:“2112”,“ExtHttpPort”:“2113”,“IntTcpPort”:“1112”,“IntSecureTcpPort”:“0”,“ExtTcpPort”:“1113”,“ExtSecureTcpPortAdvertiseAs”:“0”,“ExtSecureTcpPort”:“0”,“ExtIpAdvertiseAs”:null,“ExtTcpPortAdvertiseAs”:“0”,“ExtHttpPortAdvertiseAs”:“0”,“IntIpAdvertiseAs”:null,“IntSecureTcpPortAdvertiseAs”:“0”,“IntTcpPortAdvertiseAs”:“0”,“IntHttpPortAdvertiseAs”:“0”,“IntTcpHeartbeatTimeout”:“700”,“ExtTcpHeartbeatTimeout”:“1000”,“IntTcpHeartbeatInterval”:“700”,“ExtTcpHeartbeatInterval”:“2000”,“GossipOnSingleNode”:“False”,“ConnectionPendingSendBytesThreshold”:“10485760”,“ConnectionQueueSizeThreshold”:“50000”,“Force”:“False”,“ClusterSize”:“1”,“NodePriority”:“0”,“MinFlushDelayMs”:“2”,“CommitCount”:"-1",“PrepareCount”:"-1",“AdminOnExt”:“True”,“StatsOnExt”:“True”,“GossipOnExt”:“True”,“DisableScavengeMerging”:“False”,“ScavengeHistoryMaxAge”:“30”,“DiscoverViaDns”:“True”,“ClusterDns”:“fake.dns”,“ClusterGossipPort”:“30777”,“GossipSeed”:“System.Net.IPEndPoint[]”,“StatsPeriodSec”:“30”,“CachedChunks”:"-1",“ReaderThreadsCount”:“4”,“ChunksCacheSize”:“536871424”,“MaxMemTableSize”:“1000000”,“HashCollisionReadLimit”:“100”,“Db”:"/var/lib/eventstore",“Index”:null,“MemDb”:“False”,“SkipDbVerify”:“False”,“WriteThrough”:“False”,“Unbuffered”:“False”,“ChunkInitialReaderCount”:“5”,“ProjectionThreads”:“3”,“WorkerThreads”:“5”,“ProjectionsQueryExpiry”:“5”,“FaultOutOfOrderProjections”:“False”,“IntHttpPrefixes”:“System.String[]”,“ExtHttpPrefixes”:“System.String[]”,“EnableTrustedAuth”:“False”,“AddInterfacePrefixes”:“True”,“CertificateStoreLocation”:"",“CertificateStoreName”:"",“CertificateSubjectName”:"",“CertificateThumbprint”:"",“CertificateFile”:"",“CertificatePassword”:"",“UseInternalSsl”:“False”,“DisableInsecureTCP”:“False”,“SslTargetHost”:“n/a”,“SslValidateServer”:“True”,“AuthenticationType”:“internal”,“AuthenticationConfig”:"",“DisableFirstLevelHttpAuthorization”:“False”,“PrepareTimeoutMs”:“2000”,“CommitTimeoutMs”:“2000”,“UnsafeDisableFlushToDisk”:“False”,“BetterOrdering”:“False”,“UnsafeIgnoreHardDelete”:“False”,“SkipIndexVerify”:“False”,“IndexCacheDepth”:“16”,“OptimizeIndexMerge”:“False”,“GossipIntervalMs”:“1000”,“GossipAllowedDifferenceMs”:“60000”,“GossipTimeoutMs”:“500”,“EnableHistograms”:“False”,“LogHttpRequests”:“False”,“LogFailedAuthenticationAttempts”:“False”,“AlwaysKeepScavenged”:“False”,“SkipIndexScanOnReads”:“False”,“ReduceFileCachePressure”:“False”,“InitializationThreads”:“1”,“StructuredLog”:“True”,“MaxAutoMergeIndexLevel”:“2147483647”,“WriteStatsToDb”:“True”},“modified”:{“RunProjections”:“System”}}
[34307,01,18:12:12.518] Quorum size set to 1
[34307,01,18:12:12.526] Cannot find plugins path: “/usr/local/share/eventstore/plugins”
[34307,01,18:12:12.558] Unhandled exception while starting application:
EXCEPTION OCCURRED
Access to the path “/var/lib/eventstore/writer.chk” is denied.
[34307,01,18:12:12.572] “Access to the path “/var/lib/eventstore/writer.chk” is denied.”
EXCEPTION OCCURRED
Access to the path “/var/lib/eventstore/writer.chk” is denied.

(我再次尝试使用 sudo 运行,程序启动没有问题,但没有数据)

我猜想 sudo 会更改默认路径,没有 sudo 就不会被逆转。

还在论坛中添加了这个:https://discuss.eventstore.com/t/fail-to-run-after-using-sudo/2748/2

你查过文档了吗? https://developers.eventstore.com/server/5.0.9/server/server/default-directories.html#macos

数据没有消失,但根用户的数据库路径与普通用户的路径不匹配,因此您的数据库已在别处创建。

这是文档注释:

On macOS you will get permissions error if you run eventstore without sudo. We advise changing the configuration file and change the Db option to a place where you have access as the normal user.

当运行sudo时,数据库位于/var/lib/eventstore。我怀疑当你 运行 它没有 sudo 时,数据库位于 /usr/local/Caskroom/eventstore/5.0.8/EventStore-OSS-MacOS-macOS-v5.0.8 下的某个地方。

老实说,我避免在 macOS 上使用 运行ning EventStoreDB,而是使用 Docker。它更可预测,没有问题,并且允许您 运行 不同的版本而不会出现问题。