메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


1. 다운로드   

    http://mirror.apache-kr.org/lucene/solr/5.5.0/


2. 압축풀기

   tar xvfz solr-5.5.0.tgz


3. 링크생성 

   ln -s solr-5.5.0 solr

 

4. solr.in.sh 파일 수정(HdfsDirectoryFactory를 추가하여 index data를 hdfs에 저장하도록 하고 몇가지 옵션 설정함)

vi bin/solr.in.sh


ZK_HOST="gsda1:2181,gsda2:2181,gsda3:2181"

ZK_CLIENT_TIMEOUT="15000"

SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000"

SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000"

SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true"


# Set HDFS DirectoryFactory & Settings(현재 solr6.2버젼에서 hadoop의 HA를 지원하지 않아서 solr.hdfs.home를 지정시

      hdfs://mycluster/user/root/solr와 같이 쓰지 말고 hdfs://sda1:9000/user/root/solr로 지정해줘야함)


SOLR_OPTS="$SOLR_OPTS -Dsolr.directoryFactory=HdfsDirectoryFactory"
SOLR_OPTS="$SOLR_OPTS -Dsolr.lock.type=hdfs"
SOLR_OPTS="$SOLR_OPTS -Dsolr.hdfs.home=hdfs://mycluster/user/root/solr"
SOLR_OPTS="$SOLR_OPTS -Dsolr.zookeeper=gsda1:2181"
#SOLR_OPTS="$SOLR_OPTS -Dsolr.data.dir=hdfs://mycluster/user/root/solr/data"
SOLR_OPTS="$SOLR_OPTS -Dsolr.updatelog=hdfs://mycluster/user/root/solr/log"
SOLR_OPTS="$SOLR_OPTS -Dsolr.hdfs.confdir=$HOME/hadoop/etc/hadoop"


==>위에 값을 지정하지 않고 실행했을때 아래의 오류가 발생하면서 collection생성이 되지 않는다.

("6-가"를 참조하여 solrconfig.xml 설정을 변경하여준다.)


bin/solr create -c  -shards 4 -replicationFactor 3 -d ./configs/gc

Connecting to ZooKeeper at sda1:2181,sda2:2181,so1:2181 ...

Uploading /home/hadoop/solr-5.5.0/./configs//conf for config gc to ZooKeeper at sda1:2181,sda2:2181,so1:2181


Creating new collection 'gc' using command:

http://localhost:8983/solr/admin/collections?action=CREATE&name=gc&numShards=4&replicationFactor=3&maxShardsPerNode=12&collection.configName=gc


ERROR: Failed to create collection 'gc' due to: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://XXX.XXX.XXX.43:8983/solr: Error CREATEing SolrCore 'gc_shard2_replica3': Unable to create core [gc_shard2_replica3] Caused by: Unrecognized lockType: native


5. 각 서버에 scp로 복사하고, 링크생성

 가. 각 노드에 복사함
   scp -r -P 22 solr-5.5.0 root@gsda2:$HOME
   scp -r -P 22 solr-5.5.0 root@gsda3:$HOME
   scp -r -P 22 solr-5.5.0 root@gsda4:$HOME
   scp -r -P 22 solr-5.5.0 root@gsda5:$HOME

 나. 링크 생성 : ln -s solr-5.5.0 solr

6. solr서버 기동  (-s option은 solr.xml이 있는 폴더를 지정해준다)

가. 필요한 옵션을 지정하여 기동

./bin/solr start -z gsda1:2181,gsda2:2181,gsda3:2181 -p 8983 \

-s $HOME/solr/server/solr -cloud \

-a "-Dsolr.lock.type=hdfs \

-Dsolr.directoryFactory=HdfsDirectoryFactory \

-Dsolr.updatelog=hdfs://mycluster/user/root/solr/log \

-Dsolr.hdfs.confdir=$HOME/hadoop/etc/hadoop \

"

   * -z 옵션을 주지 않으면 내부의 zookeeper가 기동되므로 반드시 지정해야함(bin/solr.in.sh에 외부 zookeeper정보를 설정하면 생략가능함)


   ==>결과메세지

   Waiting up to 30 seconds to see Solr running on port 8983 [/]  

   Started Solr server on port 8983 (pid=134699). Happy searching!


나. 간략한 기동(solr.in.sh에 필요한 설정을 하고 기동하는 경우임)

  ./bin/solr start


* cloud구성확인 : bin/solr staus에서 liveNodes항목을 확인한다.

* 서버 기동확인(cluster로 구성된 모든 노드에서 가능함) : http://gsda1:8983/ or http://gsda2:8983/ ... http://gsda4:8983

* 서버 기동중지 : bin/solr stop -p 8983


*참고: collection만들기(collection 명칭 gc, shard수 4개, replica수 3개로 구성하는 경우)

가. 사용할 conf정보를 복사하여 수정함.($HOME/solr-5.5.0/server/solr/configsets/data_driven_schema_configs/conf에 있는 파일을 복사하여 사용함)

가. mkdir /home/hadoop/solr/configs/gc/conf

나. cd /home/hadoop/solr/configs/gc

다. cp -r $HOME/solr/server/solr/configsets/data_driven_schema_configs/conf/* .


* solrconfig.xml파일을 수정함

<directoryFactory name="DirectoryFactory"

                    class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>를 주석처리하고 아래 내용을 추가함


<directoryFactory name="DirectoryFactory" class="solr.HdfsDirectoryFactory">

  <str name="solr.hdfs.home">${solr.hdfs.home:}</str>

  <str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>

  <bool name="solr.hdfs.blockcache.enabled">true</bool>

  <int name="solr.hdfs.blockcache.slab.count">1</int>

  <bool name="solr.hdfs.blockcache.direct.memory.allocation">true</bool>

  <int name="solr.hdfs.blockcache.blocksperbank">16384</int>

  <bool name="solr.hdfs.blockcache.read.enabled">true</bool>

  <bool name="solr.hdfs.nrtcachingdirectory.enable">true</bool>

  <int name="solr.hdfs.nrtcachingdirectory.maxmergesizemb">16</int>

  <int name="solr.hdfs.nrtcachingdirectory.maxcachedmb">192</int>

</directoryFactory>


<lockType>${solr.lock.type:native}</lockType>을

<lockType>${solr.lock.type:hdfs}</lockType> 로 변경한다.


나. colleciton을 zookeeper의 configs znode에 upload


$HOME/solr/server/scripts/cloud-scripts/zkcli.sh -z gsda1:2181 -cmd upconfig -c gc -n gc -d $HOME/solr/server/solr/configsets/gc/conf/


* zookeeper의 configs/store에 업로드된다.

 (http://sda1:8080/solr/#/~cloud?view=tree로 확인 가능함, configs폴더밑에 gc폴더가 있고 그 밑에 설정파일이 있음)


다. collection생성 


방법1. conf위치를 지정하지 않고 collection 생성(zookeeper에 upload한 정보가 있다면 그것을 사용하여 생성함, SolrCloud에서는 이방법을 사용해야함)

  ==> bin/solr create -c gc -shards 4 -replicationFactor 2

(명령 참고 : solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port])


Connecting to ZooKeeper at sda1:2181,sda2:2181,so1:2181 ...

Uploading /home/hadoop/solr/server/solr/configsets/data_driven_schema_configs/conf for config gc to ZooKeeper at sda1:2181,sda2:2181,so1:2181


Creating new collection 'gc' using command:

http://localhost:8983/solr/admin/collections?action=CREATE&name=gc&numShards=4&replicationFactor=3&maxShardsPerNode=12&collection.configName=gc


* hadoop conf파일디렉토리를 지정하여도 collection생성시 solr가 HA를 인식하지 못하여 아래와 같은 오류가 발생하므로 cluster명칭을 지정하지 말고 gsda1:9000과 같이 NameNode를 지정해 줘야 오류가 발생하지 않음)

    (solr기동할때 -Dsolr.hdfs.confdir=/svc/apps/sda/bin/hadoop/hadoop/etc/hadoop 를 지정하여줌)

ERROR: Failed to create collection 'gc' due to: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://XXX.XXX.XXX.43:8983/solr: Error CREATEing SolrCore 'gc_shard4_replica3': Unable to create core [gc_shard4_replica3] Caused by: mycluster


*collection의 conf위치를 지정하지 않으면 zookeeper에 config정보를 확인하고 등록된것이 없으면 디폴트로 "$HOME/solr/server/solr/configsets/data_driven_schema_configs/conf"에 있는 conf정보를 zookeeper에 업로드 하고 이것을 사용함.



방법2.  conf위치를 지정하여 collection 생성(로컬 파일에 위치한 정보를 이용하여 생성하는 경우)

===>-bash-4.1# bin/solr create -c gc -shards 4 -replicationFactor 3 -d $HOME/solr/server/solr/configsets/gc


Copying configuration to new core instance directory:

/svc/apps/sda/bin/hadoop/solr/server/solr/gc


Creating new core 'gc' using command:

http://localhost:8983/solr/admin/cores?action=CREATE&name=gc&instanceDir=gc


{

  "responseHeader":{

    "status":0,

    "QTime":743},

  "core":"gc"}


7. colleciton 변경

가. colleciton삭제

   bin/solr delete -c gc


나. 변경된 config정보를 zookeeper에 upload

./server/scripts/cloud-scripts/zkcli.sh -zkhost gsda1:2181,gsda2:2181,gsda3:2181 -cmd upconfig --confname gc -confdir $HOME/solr/server/solr/configsets/gc/conf


다. colleciton생성(create or create_collction 모두 가능함)

bin/solr create_collection -c gc -shards 4 -replicationFactor 3


8. collection healthcheck

   bin/solr healthcheck -c gc -z gsda1:2181,gsda2:2181,gsda3:2181


* 데몬 확인 : jps -m

17895 jar --module=http


번호 제목 글쓴이 날짜 조회 수
740 [CDP7.1.7] oozie sqoop action으로 import혹은 export수행시 발생한 오류에 대한 자세한 로그 확인 하는 방법 gooper 2024.04.19 0
739 [Impala] alter table구문수행시 "WARNINGS: Impala does not have READ_WRITE access to path 'hdfs://nameservice1/DATA/Temp/DB/source/table01_ccd'" 발생시 조치 gooper 2024.04.26 0
738 [CDP7.1.7, Replication]Encryption Zone내 HDFS파일을 비Encryption Zone으로 HDFS Replication시 User hdfs가 아닌 hadoop으로 수행하는 방법 gooper 2024.01.15 1
737 [CDP7.1.7]Hive Replication수행중 Specified catalog.database.table does not exist : hive.db명.table명 오류 발생시 조치방법 gooper 2024.04.05 1
736 [CDP7.1.7][Replication]Table does not match version in getMetastore(). Table view original text mismatch gooper 2024.01.02 2
735 ./gradlew :composeDown 및 ./gradlew :composeUp 를 성공했을때의 메세지 gooper 2023.02.20 6
734 호출 url현황 gooper 2023.02.21 6
733 [vue storefrontui]외부 API통합하기 참고 문서 총관리자 2022.02.09 7
732 [Cloudera Agent] Metadata-Plugin throttling_logger INFO (713 skipped) Unable to send data to nav server. Will try again. gooper 2022.05.16 7
731 [CDP7.1.7, Hive Replication]Hive Replication진행중 "The following columns have types incompatible with the existing columns in their respective positions " 오류 gooper 2023.12.27 7
730 [CDP7.1.7]Oozie job에서 ERROR: Kudu error(s) reported, first error: Timed out: Failed to write batch of 774 ops to tablet 8003f9a064bf4be5890a178439b2ba91가 발생하면서 쿼리가 실패하는 경우 gooper 2024.01.05 7
729 eclipse editor 설정방법 총관리자 2022.02.01 9
728 주문히스토리 조회 총관리자 2022.04.30 10
727 [bitbucket] 2022년 3월 2일 부터 git 작업시 기존에 사용하던 비빌번호를 사용할 수 없도록 변경되었다. 총관리자 2022.04.30 10
726 oozie의 sqoop action수행시 ooize:launcher의 applicationId를 이용하여 oozie:action의 applicationId및 관련 로그를 찾는 방법 gooper 2023.07.26 10
725 주문 생성 데이터 예시 총관리자 2022.04.30 11
724 [EncryptionZone]User:testuser not allowed to do "DECRYPT_EEK" on 'testkey' gooper 2023.06.29 11
723 [CDP7.1.7]Encryption Zone내부/외부 간 데이터 이동(mv,cp)및 CTAS, INSERT SQL시 오류(can't be moved into an encryption zone, can't be moved from an encryption zone) gooper 2023.11.14 11
722 [CDP7.1.7]impala-shell수행시 간헐적으로 "-k requires a valid kerberos ticket but no valid kerberos ticket found." 오류 gooper 2023.11.16 11
721 [Encryption Zone]Encryption Zone에 생성된 table을 select할때 HDFS /tmp/zone1에 대한 권한이 없는 경우 gooper 2023.06.29 12

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로