nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

JetStream not enabled for account

Open amitamit281 opened this issue 2 years ago • 6 comments

Defect

Make sure that these boxes are checked before submitting your issue -- thank you!

  • [ X] Included nats-server -DV output
  • [x] Included a [Minimal, Complete, and Verifiable example] (https://stackoverflow.com/help/mcve)

Versions of nats-server and affected client libraries used:

/bin $ synadia-server -DV [187] 2021/11/17 21:46:43.997566 [INF] Starting nats-server [187] 2021/11/17 21:46:43.997616 [INF] OSS-Version : 2.6.3 [187] 2021/11/17 21:46:43.997620 [INF] Synadia-Version : 2.6.3+synadia1 [187] 2021/11/17 21:46:43.997623 [INF] Build-Date : 2021-10-28T20:34:07Z [187] 2021/11/17 21:46:43.997635 [INF] Build-Tool : goreleaser [187] 2021/11/17 21:46:43.997644 [INF] Git : eab1d6797ca90c6b51af9891e3cfc55526ee895e [187] 2021/11/17 21:46:43.997652 [DBG] Go build : go1.16.9 [187] 2021/11/17 21:46:43.997664 [INF] Name : NAUYB7FJATAILCRKLWDPAZCQIBCWL6JSBRTZ5FQPVH5LUNMFYO4D7IDZ [187] 2021/11/17 21:46:43.997671 [INF] ID : NAUYB7FJATAILCRKLWDPAZCQIBCWL6JSBRTZ5FQPVH5LUNMFYO4D7IDZ [187] 2021/11/17 21:46:43.997717 [DBG] Created system account: "$SYS" [187] 2021/11/17 21:46:44.002260 [INF] Listening for client connections on 0.0.0.0:4222 [187] 2021/11/17 21:46:44.002315 [DBG] Get non local IPs for "0.0.0.0" [187] 2021/11/17 21:46:44.002434 [DBG] ip=100.64.2.7 [187] 2021/11/17 21:46:44.002471 [INF] Server is ready

OS/Container environment:

Ubuntu Server 18.04 LTS amd64

Steps or code to reproduce the issue:

Have a jetstream enabled account with 1byte mem storage and few GBs disk storage.

Run below command. it says JetStream not enabled for account

nats --server nats://<server name>:port --creds <cred file> str  ls  --trace
10:24:13 >>> $JS.API.STREAM.NAMES
{"offset":0}
10:24:13 <<< $JS.API.STREAM.NAMES
{"type":"io.nats.jetstream.api.v1.stream_names_response","error":{"code":503,"err_code":10039,"description":"JetStream not enabled for account"},"total":0,"offset":0,"limit":0,"streams":null}

Logs shows [ERR] Error configuring jetstream for account [ADS4KVBEYQLHKXK25JD2ONXHAKN36CDLOMNHJDS3FOWY7CBIM55THE6L/cn=issuer,ou=dpi,l=dev,o=starbucks]: insufficient memory resources available

Run nats --context=pd --creds sys.creds --server server:port server req jsz --all displays number of streams under that account. it had four streams.

I check monitor accountz API. it showed jetstream:enabled & complete:true

I edited the account with zero byte mem storage and pushed to cluster. I was able to list the streams. Again edited and pushed the account with 1byte mem storage. Still i was able to list the streams.

Expected result:

it should continue to list streams.

Actual result:

amitamit281 avatar Nov 17 '21 22:11 amitamit281

Hi @amitamit281 , could you add more details like what's the cred file looks like and re-format the output and command? It's not so clear now.

xieyuschen avatar Apr 20 '22 12:04 xieyuschen

@amitamit281 Also want to check with you that how to set the max memory to 1byte. I found the default is 1MB if I set the config like this:

jetstream {

    max_mem: 1G
    max_file: 100G
}

accounts {
    HR: {
        jetstream {
            max_mem: 1
            max_file: 1G
            max_streams: 10
            max_consumers: 100
        }
    }
}}

xieyuschen avatar Apr 20 '22 12:04 xieyuschen

@xieyuschen cred file has only one format. this is for authentication. It has user public jwt & private key like below. you can set max_mem: 1b

-----BEGIN NATS USER JWT-----
eyJ0eXAiOiJKV1QiLCJhbGciOiJlZDI1NTE5LW5rZXkifQ.eyJqdGkiOiJUTEI1MkZHQURCWEpSQjZaNFNMVkZUQlkzSDNYTkVMTDQ3SlZRSllGUzZQWUNPNE5DRUFBIiwiaWF0IjoxNjQ1ODI3NjgwLCJpc3MiOiJBQzM2WU1GNlRZUjdGMlJDU0dPVllVQlAzNUw2UDVMSFU3UTVKRzJYTVhLN0laNTRYMlFBVERPWSIsIm5hbWUiOiJ1Iiwic3ViIjoiVUNTN0tKSVhZUEFRVU5YRk01QlFVUjJDQkJOVjJBV0VINFlUSkFBMkRZRkNFN0xYUVVYQTJLQjciLCJuYXRzIjp7InB1YiI6eyJkZW55IjpbIiRKUy5BUEkuU1RSRUFNLkNSRUFURS4qIl19LCJzdWIiOnt9LCJzdWJzIjotMSwiZGF0YSI6LTEsInBheWxvYWQiOi0xLCJ0eXBlIjoidXNlciIsInZlcnNpb24iOjJ9fQ.30qDgK9a0IOQxzxR3H1v0hH1XEq63BzN3uP4-Mfqqc0nZwhYaAeGsfDxiW0nozyjISAU82FKCF7Ck8AvTvkfBA
------END NATS USER JWT------

************************* IMPORTANT *************************
NKEY Seed printed below can be used to sign and prove identity.
NKEYs are sensitive and should be treated as secrets.

-----BEGIN USER NKEY SEED-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
------END USER NKEY SEED------

*************************************************************

dhairya105 avatar Apr 22 '22 15:04 dhairya105

@dhairya105 Thanks for your reply, I have known the authorization file path, but I still wander how to set max_mem to 1B. I don't find such in the doc, the M is the min unit. I tried this one:

# foo.conf
jetstream {

    max_mem: 1G
    max_file: 100G
}

accounts {
    HR: {
        jetstream {
            max_mem: 1b
            max_file: 1G
            max_streams: 10
            max_consumers: 100
        }
    }
}}

And run the command nats-server -c foo.con to start the server but got this error:

nats-server: foo.conf:10:13: Expected a parseable size for "max_mem", got 1b

How do you think about it? Thanks

xieyuschen avatar Apr 22 '22 17:04 xieyuschen

@xieyuschen you can try like this. default unit is byte.

# foo.conf
jetstream {

    max_mem: 1000000
    max_file: 100000000
}

accounts {
    HR: {
        jetstream {
            max_mem: 1
            max_file: 1000000
            max_streams: 10
            max_consumers: 100
        }
    }
}}

amitamit281 avatar Apr 23 '22 04:04 amitamit281

Hi @amitamit281 , I set it properly. But actually I think it's an issue about JetStream not enabled for account, you could find many similiar issues such as https://github.com/nats-io/nats-server/issues/2819, https://github.com/nats-io/nats-server/issues/2367.

Let me try to find out the reason about it, thanks:)

xieyuschen avatar Apr 23 '22 07:04 xieyuschen

Seems you'll have to add --js-mem-storage -1 and/or --js-disk-storage -1 when you generate the account JWT.

lionello avatar Jun 12 '23 23:06 lionello