You can run Solr using one the available examples that are shipped with Solr.
This will create the example schema and index in Solr the example data.
This could be a quick and easy way to start using Solr and exploring its features.
To start Solr using an example:
$ bin/solr start -e EXAMPLE_NAME
To see the available examples run the command:
$ bin/solr start -help
-e example
Where example is the name of the example to run.
Available examples:
techproducts: Comprehensive example illustrating many of Solr core capabilities
cloud: SolrCloud example
dih: Data Import Handler
schemaless: Schema-less example
Note that the Solr home directory of the started example will be located under "
${SOLR_ROOT}/example/EXAMPLE_NAME/".
-
Using "techproducts" example:
Note that starting Solr with the "techproducts" example will run a Standalone Server.
Note also that documents under "/opt/solr/example/exampledocs" directory will be indexed.
$ /opt/solr/bin/solr start -e techproducts
Creating Solr home directory /opt/solr/example/techproducts/solr
Starting up Solr on port 8983 using command: "bin/solr" start -p 8983 -s "example/techproducts/solr"
Waiting up to 180 seconds to see Solr running on port 8983 [|]
Started Solr server on port 8983 (pid=22135). Happy searching!
Created new core 'techproducts'
Indexing tech product example docs from /opt/solr/example/exampledocs
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/techproducts/update using content-type application/xml...
POSTing file hd.xml to [base]
POSTing file vidcard.xml to [base]
POSTing file sd500.xml to [base]
POSTing file monitor2.xml to [base]
POSTing file manufacturers.xml to [base]
POSTing file gb18030-example.xml to [base]
POSTing file utf8-example.xml to [base]
POSTing file solr.xml to [base]
POSTing file mem.xml to [base]
POSTing file ipod_other.xml to [base]
POSTing file mp500.xml to [base]
POSTing file money.xml to [base]
POSTing file monitor.xml to [base]
POSTing file ipod_video.xml to [base]
14 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/techproducts/update...
Time spent: 0:00:00.530
Solr techproducts example launched successfully. Direct your Web browser to http://localhost:8983/solr to visit the Solr Admin UI
Solr Admin UI:

Verify Solr process:
$ ps -ef | grep solr
30594 /opt/jdk1.8.0_172/bin/java
-server
-Xms512m
-Xmx512m
-XX:+UseG1GC
-XX:+PerfDisableSharedMem
-XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=250
-XX:+UseLargePages
-XX:+AlwaysPreTouch
-verbose:gc
-XX:+PrintHeapAtGC
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime
-Xloggc:/opt/solr/example/techproducts/solr/../logs/solr_gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=9
-XX:GCLogFileSize=20M
-Dsolr.jetty.inetaccess.includes=
-Dsolr.jetty.inetaccess.excludes=
-Dsolr.log.dir=/opt/solr/example/techproducts/solr/../logs
-Djetty.port=8983
-DSTOP.PORT=7983
-DSTOP.KEY=solrrocks
-Duser.timezone=UTC
-Djetty.home=/opt/solr/server
-Dsolr.solr.home=/opt/solr/example/techproducts/solr
-Dsolr.data.home=
-Dsolr.install.dir=/opt/solr
-Dsolr.default.confdir=/opt/solr/server/solr/configsets/_default/conf
-Dlog4j.configurationFile=/opt/solr/server/resources/log4j2.xml
-Xss256k
-Dsolr.jetty.https.port=8983
-Dsolr.log.muteconsole
-XX:OnOutOfMemoryError=/opt/solr/bin/oom_solr.sh
8983
/opt/solr/example/techproducts/solr/../logs
-jar
start.jar
--module=http
Stop Solr:
$ bin/solr stop -all
Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 30594 to stop gracefully.
-
Using "cloud" example:
$ bin/solr start -e cloud
Welcome to the SolrCloud example!
This interactive session will help you launch a SolrCloud cluster on your local workstation.
To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2]:
Ok, let start up 2 Solr nodes for your example SolrCloud cluster.
Please enter the port for node1 [8983]:
Please enter the port for node2 [7574]:
Creating Solr home directory /opt/solr/example/cloud/node1/solr
Cloning /opt/solr/example/cloud/node1 into /opt/solr/example/cloud/node2
Starting up Solr on port 8983 using command: "bin/solr" start -cloud -p 8983 -s "example/cloud/node1/solr"
Waiting up to 180 seconds to see Solr running on port 8983 [|]
Started Solr server on port 8983 (pid=24045). Happy searching!
Starting up Solr on port 7574 using command: "bin/solr" start -cloud -p 7574 -s "example/cloud/node2/solr" -z localhost:9983
Waiting up to 180 seconds to see Solr running on port 7574 [|]
Started Solr server on port 7574 (pid=24262). Happy searching!
INFO - 2020-06-28 10:46:53.356; org.apache.solr.common.cloud.ConnectionManager; Waiting for client to connect to ZooKeeper
INFO - 2020-06-28 10:46:53.375; org.apache.solr.common.cloud.ConnectionManager; zkClient has connected
INFO - 2020-06-28 10:46:53.375; org.apache.solr.common.cloud.ConnectionManager; Client is connected to ZooKeeper
INFO - 2020-06-28 10:46:53.389; org.apache.solr.common.cloud.ZkStateReader; Updated live nodes from ZooKeeper... (0) -> (2)
INFO - 2020-06-28 10:46:53.403; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 ready
Now let create a new collection for indexing documents in your 2-node cluster.
Please provide a name for your new collection: [gettingstarted]
How many shards would you like to split gettingstarted into? [2]
How many replicas per shard would you like to create? [2]
Please choose a configuration for the gettingstarted collection, available options are: _default or sample_techproducts_configs [_default]
Created collection 'gettingstarted' with 2 shard(s), 2 replica(s) with config-set 'gettingstarted'
Enabling auto soft-commits with maxTime 3 secs using the Config API
POSTing request to Config API: http://localhost:8983/solr/gettingstarted/config
{"set-property":{"updateHandler.autoSoftCommit.maxTime":"3000"}}
Successfully set-property updateHandler.autoSoftCommit.maxTime to 3000
SolrCloud example running, please visit: http://localhost:8983/solr
Solr Admin UI:

Verify Solr processes:
$ ps -ef | grep solr
24045 /opt/jdk1.8.0_172/bin/java
-server
-Xms512m
-Xmx512m
-XX:+UseG1GC
-XX:+PerfDisableSharedMem
-XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=250
-XX:+UseLargePages
-XX:+AlwaysPreTouch
-verbose:gc
-XX:+PrintHeapAtGC
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime
-Xloggc:/opt/solr/example/cloud/node1/solr/../logs/solr_gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=9
-XX:GCLogFileSize=20M
-Dsolr.jetty.inetaccess.includes=
-Dsolr.jetty.inetaccess.excludes=
-DzkClientTimeout=15000
-DzkRun
-Dsolr.log.dir=/opt/solr/example/cloud/node1/solr/../logs
-Djetty.port=8983
-DSTOP.PORT=7983
-DSTOP.KEY=solrrocks
-Duser.timezone=UTC
-Djetty.home=/opt/solr/server
-Dsolr.solr.home=/opt/solr/example/cloud/node1/solr
-Dsolr.data.home=
-Dsolr.install.dir=//opt/solr
-Dsolr.default.confdir=/opt/solr/server/solr/configsets/_default/conf
-Dlog4j.configurationFile=/opt/solr/server/resources/log4j2.xml
-Xss256k
-Dsolr.jetty.https.port=8983
-Dsolr.log.muteconsole
-XX:OnOutOfMemoryError=/opt/solr/bin/oom_solr.sh
8983
/opt/solr/example/cloud/node1/solr/../logs
-jar
start.jar
--module=http
24262 /opt/jdk1.8.0_172/bin/java
-server
-Xms512m
-Xmx512m
-XX:+UseG1GC
-XX:+PerfDisableSharedMem
-XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=250
-XX:+UseLargePages
-XX:+AlwaysPreTouch
-verbose:gc
-XX:+PrintHeapAtGC
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime
-Xloggc:/opt/solr/example/cloud/node2/solr/../logs/solr_gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=9
-XX:GCLogFileSize=20M
-Dsolr.jetty.inetaccess.includes=
-Dsolr.jetty.inetaccess.excludes=
-DzkClientTimeout=15000
-DzkHost=localhost:9983
-Dsolr.log.dir=/opt/solr/example/cloud/node2/solr/../logs
-Djetty.port=7574
-DSTOP.PORT=6574
-DSTOP.KEY=solrrocks
-Duser.timezone=UTC
-Djetty.home=/opt/solr/server
-Dsolr.solr.home=/opt/solr/example/cloud/node2/solr
-Dsolr.data.home=
-Dsolr.install.dir=//opt/solr
-Dsolr.default.confdir=/opt/solr/server/solr/configsets/_default/conf
-Dlog4j.configurationFile=/opt/solr/server/resources/log4j2.xml
-Xss256k
-Dsolr.jetty.https.port=7574
-Dsolr.log.muteconsole
-XX:OnOutOfMemoryError=/opt/solr/bin/oom_solr.sh
7574
/opt/solr/example/cloud/node2/solr/../logs
-jar
start.jar
--module=http
Stop Solr:
$ bin/solr stop -all
Sending stop command to Solr running on port 7574 ... waiting up to 180 seconds to allow Jetty process 24262 to stop gracefully.
Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 24045 to stop gracefully.