solr安装,无法启动示例(solr installation, cannot start examples)
第一:我想学习solr。 所以我想从http://lucene.apache.org/solr/quickstart.html执行快速入门教程
在Ubuntu 14.04 64位我安装solr以下方式:
在/ opt每wget我采取了最新的版本6.3.0。 这是作为根。
然后我通过提取服务安装文件
tar xzf solr-6.3.0.tgz solr-6.3.0/bin/install_solr_service.sh --strip-components=2
也由根!
我让它运行
sudo ./install_solr_service.sh solr-6.3.0.tgz
导致用户/组solr,启动solr作为服务,从/ opt / solr创建符号链接到/opt/solr-6.3.0,将solr.home作为用户solr作为所有者的/ var / solr。
Solr按预期启动,因此http:// localhost:8983 / solr /#/显示浏览器中的破折号。
我停下来用通常的命令
service solr stop
该服务启动示例。
这里的问题是:
当我以root身份启动时:
root@duke:/opt/solr# bin/solr start -e cloud -noprompt
这里结果如下:
“欢迎来到SolrCloud的例子!
为示例SolrCloud群集启动2个Solr节点。
Solr主目录/ opt / solr / example / cloud / node1 / solr已经存在。 / opt / solr / example / cloud / node2已经存在。
使用以下命令启动端口8983上的Solr:/ opt / solr / bin / solr start -cloud -p 8983 -s“/ opt / solr / example / cloud / node1 / solr”
警告:以root用户身份启动Solr是一种安全风险,不被视为最佳做法。 退出。 请参阅参考指南。 要覆盖此检查,请从参数'-force'开始
错误:进程退出,出现错误:1(退出值:1)“
所以root不是正确的所有者,我理解这是因为创建了一个新的用户solr。
然后我更改为solr作为用户启动示例:
solr@duke:/opt/solr$ bin/solr start -e cloud -noprompt
“欢迎来到SolrCloud的例子!
为示例SolrCloud集群启动2个Solr节点。
创建Solr主目录/ opt / solr / example / cloud / node1 / solr
错误:无法创建目标'/ opt / solr / example / cloud / node1 / solr'目录“
因此,作为root的第一个测试给我没有权限,因为solr,第二个作为用户solr没有权限创建目录/文件。
怎么办?
First: I want to learn solr. So I want to execute the quickstart tutorial from http://lucene.apache.org/solr/quickstart.html
On ubuntu 14.04 64 bit I installed solr the following way:
In /opt per wget I took the latest version 6.3.0. This was made as root.
Then I extracted the service installation file by
tar xzf solr-6.3.0.tgz solr-6.3.0/bin/install_solr_service.sh --strip-components=2
Also by root!
I let it run by
sudo ./install_solr_service.sh solr-6.3.0.tgz
that led to user/group solr, started solr as a service, made a symlink from /opt/solr to /opt/solr-6.3.0, made solr.home to /var/solr with user solr as owner etc.
Solr is started as expected so http://localhost:8983/solr/#/ shows me the dash in the browser.
I stop with the usual command
service solr stop
the service to start the examples.
And here the problem:
When I start as root:
root@duke:/opt/solr# bin/solr start -e cloud -noprompt
here the results:
"Welcome to the SolrCloud example!
Starting up 2 Solr nodes for your example SolrCloud cluster.
Solr home directory /opt/solr/example/cloud/node1/solr already exists. /opt/solr/example/cloud/node2 already exists.
Starting up Solr on port 8983 using command: /opt/solr/bin/solr start -cloud -p 8983 -s "/opt/solr/example/cloud/node1/solr"
WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting. Please consult the Reference Guide. To override this check, start with argument '-force'
ERROR: Process exited with an error: 1 (Exit value: 1)"
So root is not the correct owner, which I understand because there is a new user solr created.
Then I change to solr as user to start the examples:
solr@duke:/opt/solr$ bin/solr start -e cloud -noprompt
"Welcome to the SolrCloud example!
Starting up 2 Solr nodes for your example SolrCloud cluster.
Creating Solr home directory /opt/solr/example/cloud/node1/solr
ERROR: Destination '/opt/solr/example/cloud/node1/solr' directory cannot be created"
So the first test as root give me no permission because of solr and the second one as user solr give me no permission to create directories/files.
What is to do???
原文:https://stackoverflow.com/questions/41638868
最满意答案
哪种解决方案最好取决于您在UI中定义选项的方式。
定义可能选择的最简单方法是使用枚举。 如果你走这条路线,我建议使用
EnumMap
将类型映射到动作,或者(假设动作是可变的或需要根据请求创建)动作工厂。例如:
EnumMap<Type, Class<Action>> typeToActionMap = new EnumMap<>(); typeToActionMap.put(Type.Large, LargeAction.class); typeToActionMap.put(Type.Medium, MediumAction.class); typeToActionMap.put(Type.Small, SmallAction.class);
上面我使用动作类作为一种工厂。 如果动作可以是单例,则可以使地图的值成为动作。 正如@dhke建议的那样,你可以使用Guava的
ClassToInstanceMap
来实现这个映射:ClassToInstanceMap<Action> actionTypeToAction = MutableClassToInstanceMap.create(); typeToActionMap.putInstance(LargeAction.class, new LargeAction(...)); typeToActionMap.putInstance(MediumAction.class, new MediumAction(...));
如果您已经为每个选择都有一个唯一类型,那么您只需要找到一种方法来进行映射。 一种简单的方法是让您的类型都实现一个通用接口:
public interface ActionProvider { Class<? extends Action> getActionClass();
Which solution is best depends on how you define the choices in your UI.
The simplest way to define the possible choices is with an enum. If you go that route, I would suggest using an
EnumMap
to Map the type to the action, or (assuming the actions are mutable or need to be created per request) an action factory.For example:
EnumMap<Type, Class<Action>> typeToActionMap = new EnumMap<>(); typeToActionMap.put(Type.Large, LargeAction.class); typeToActionMap.put(Type.Medium, MediumAction.class); typeToActionMap.put(Type.Small, SmallAction.class);
Above I use a the action class as a kind of factory. If the actions can be singletons, you can make the value of the map an action. As @dhke suggested, you can use Guava's
ClassToInstanceMap
to to this mapping:ClassToInstanceMap<Action> actionTypeToAction = MutableClassToInstanceMap.create(); typeToActionMap.putInstance(LargeAction.class, new LargeAction(...)); typeToActionMap.putInstance(MediumAction.class, new MediumAction(...));
If you already have a unique type for each selection then you just need to find a way to do the mapping. A simple way is to have your types all implement a common interface:
public interface ActionProvider { Class<? extends Action> getActionClass();
相关问答
更多-
Guids肯定适用于您描述的问题,但是,当两个用户将Boston添加到他们的数据库时会发生什么? 你最终会得到大量的重复 - 特别是在普通城市。 你能否用城市信息预先填充数据库? Guids would certainly work for the problem you describe, however, what happens when two users add Boston to their databases? You'll end up with a large number of dupl ...
-
数值对象与DB ID和实体的DDD类设计困境(DDD class design dilemma with Value Objects with DB id and Entities)[2023-07-30]
一个实体有一个相当独特的个人生命周期。 它独立时有意义。 Order / OrderItem的经典示例可能会有所帮助。 如果一个OrderItem成为一个实体,它将有一个自己的生命周期。 然而,这并没有太大意义,因为它是Order 一部分 。 在查看订单时,这看起来总是显而易见的,但在查看自己的类时却不那么明显,因为类之间可能有一些引用。 例如,一个OrderItem代表我们销售的一些Product 。 Product具有自己的生命周期。 我们可以有一个独立的Product列表。 我们如何建模OrderIt ... -
它应该由创造它的人来处置 - 与其创造的范围相同。 你创建一个对象,你负责处理它。 就那么简单。 It should be disposed by whoever created it - the same scope as its creation. You create an object, you're responsible for disposing it. Simple as that.
-
Java代码设计困境(Java code design dilemma)[2022-07-28]
由于MyClass的实例在没有QueryService实例的情况下QueryService ,您如何将查询服务的引用传递给MyClass的构造函数: public abstract class MyClass { private final QueryService queryService; public MyClass (QueryService queryService) { this.queryService = queryService; } p ... -
React / Redux:分离表现和容器组件的困境。(React/Redux: separating presentational and container components dilemma.)[2022-03-02]
这是经典的React / Redux困境。 我的答案是将“项目视图”提取到组件并向其添加onItemClick支柱。 当然,您的项目视图应该接收要显示的item ,并且可以将其作为参数发送到您的容器。 e参数属于您的演示文稿,而不属于您的操作创建者,即业务逻辑。 并且在DOM中存储数据(就像使用data-属性一样,React根本不需要)。 这样的事情(我倾向于从下到上,从简单到复杂): //Item.js export default class Item extends Component { co ... -
数据库设计困境(Data Base Design Dilemma)[2023-07-15]
如果不是很清楚你的建模究竟是什么,那么非常精确是非常棘手的,但是这里...... 正如您所指出的,至少有两种策略可以获得您想要的“原型的可变实例副本”功能: 1)在基于原型创建实例时,完全从原型中复制实例数据。 之后他们之间没有联系。 PRO:使用较少的逻辑更快地访问实例数据。 CON 1:对原型的任何更新都不会进入实例。 例如,如果您在原型中有公司地址错误。 CON 2:如果您有大量记录,那么您在复制数据库数据(在某种程度上)会造成浪费。 2)在基于原型创建实例时,存储对“父”记录(即原型)的引用,然后仅 ... -
首选的方式(但不是唯一的方法): 将驱动程序标记为已删除(具有布尔删除列或称为IsActive ),而不实际删除驱动程序或相关信息。 这样你仍然可以历史报道。 解决这个问题的一种方法是在表格上创建视图; 一个用于AllDrivers和一个用于ActiveDrivers的视图,并且直接连接到这些而不是表格,或者只是将IsActive谓词添加到查询的WHERE子句中。 The preferred way (but not the only way): Mark a driver as deleted (have ...
-
哪种解决方案最好取决于您在UI中定义选项的方式。 定义可能选择的最简单方法是使用枚举。 如果你走这条路线,我建议使用EnumMap将类型映射到动作,或者(假设动作是可变的或需要根据请求创建)动作工厂。 例如: EnumMap
> typeToActionMap = new EnumMap<>(); typeToActionMap.put(Type.Large, LargeAction.class); typeToActionMap.put(Type.Medium, Me ... -
插件架构,设计困境(Plug-in architecture, design dilemma)[2019-10-01]
这取决于。 如果通用完成工作,并有其他设计约束或驱动程序支持这种方法,那么我可能会坚持这一点。 但是,如果保持通用,或者在狭窄/严格定义的范围内开始限制我可以在功能上做的事情,或者开始扭曲系统的其他方面,那么它绝对是走硬路径的时候。 现在小疼痛,以后疼痛减轻(较大)。 It depends. If being generic got the job done, and there were other design constraints or drivers that supported this app ... -
看来装饰图案对你的需求有好处。 想想有不同上衣的披萨。 你可以用许多上衣来扭曲基本披萨,最后你可以调用一个功能来总结奖品或其他什么。 它是一种包装器,您将对象传递给下一个类。 因此,您只需要一个基本类,并且可以在需要时添加新的(顶级)类。 It seems a decorator pattern is good for your needs. Think of a pizza with different tops. You can warp the basic pizza with many tops a ...