Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change cache dir with namespace #3533

Closed
eightroad opened this issue Aug 6, 2020 · 3 comments · Fixed by #3859 or #3882
Closed

change cache dir with namespace #3533

eightroad opened this issue Aug 6, 2020 · 3 comments · Fixed by #3859 or #3882
Assignees
Labels
kind/discussion Category issues related to discussion kind/feature type/feature
Milestone

Comments

@eightroad
Copy link

Is your feature request related to a problem? Please describe.
I want to change nacos cache dir. but if i special the property "com.alibaba.nacos.naming.cache.dir", the cache dir dismissed {namespce} path。

Describe the solution you'd like
I check the code in com.alibaba.nacos.client.naming.NacosNamingService ,seems cacheDir should mean nacos home 。see below。
it shold cacheDir = System.getProperty("com.alibaba.nacos.naming.cache.dir")+/naming/" + namespace;

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
the origin code is:
private void initCacheDir() {
cacheDir = System.getProperty("com.alibaba.nacos.naming.cache.dir");
if (StringUtils.isEmpty(cacheDir)) {
cacheDir = System.getProperty("user.home") + "/nacos/naming/" + namespace;
}
}

@KomachiSion
Copy link
Collaborator

looks good. And can you check for config module, it should have another cache dir.

What's more, there may be some other dir is depend user.home, we may need to organize and discuss whether these cache dirs can be processed in a unified manner.

@KomachiSion KomachiSion added kind/feature type/feature kind/discussion Category issues related to discussion labels Aug 6, 2020
@KomachiSion KomachiSion added this to the 1.4.0 milestone Aug 6, 2020
@realJackSun
Copy link
Collaborator

realJackSun commented Sep 1, 2020

@i will solve it@

@realJackSun
Copy link
Collaborator

realJackSun commented Sep 21, 2020

This is concerned with the unification of paths in naming module.
The unification process includes two parts.

  1. Unifying the cache paths of config module (see PR [ISSUE#3533] change cache dir with namespace -- part 1 #3859 ):
    (1) If the environment variable 'JM.SNAPSHOT.PATH' is set, use ${sys:JM.SNAPSHOT.PATH}/nacos/naming as the parent dir of naming cache files.
    (2) Else, use ${sys:user.home}/nacos/config as the parent dir of cache files.
    In this way, config cache and naming cache are in step with each other.

  2. Unifying the logging paths (see PR [ISSUE#3533] change cache dir with namespace -- part 2 #3882 ):
    (1) If the environment variable 'JM.LOG.PATH' is set, use ${sys:JM.LOG.PATH}/nacos as the parent dir of log files for naming and config module.
    (2) Else, use ${sys:user.home}/logs/nacos as the parent dir of log files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment