Description

The global search box in Junos Space is a widely used tool. At times, we notice that when something is searched, the results are incorrect. This is usually resolved if the "Refresh Search Index" is done.

Symptoms

In Junos Space 13.x and 14.x, we sometimes find that the search results from the global search don't yield the results we expect. For example, the user discovers a device and when the user tries to search the newly discovered device through the hostname, the global search will not display the result, even though the device is in the database.

To resolve this, if a manual "Refresh Search Index" under Administration > Applications > Platform > Refresh Search Index is triggered, the issue is temporarily resolved. However, this occurs each time some write/delete operation happens on the mysql database.

Solution

One of the reasons could be due to the incorrect time synchronization between mysql and the server time:

mysql> select now();
+——————————-----------+
| now()                                         | 
+——————————-----------+
| 2015-11-11 08:37:33                 |
+——————————-----------+
1 row in set (0.00 sec)
mysql> \q

Bye

[root@space-0319082015000011 ~]# date
Wed Nov 11 09:37:40 CET 2015

If you look at the above output, you can see that the mysql time is different from the system time. Due to the mismatch in the times between mysql and the system time, the auto refresh search index doesn't get triggered automatically whenever there is a change in the database. Usually, this mismatch occurs if the user follows the Unix method of changing the system date/time instead of using the option that Junos Space provides with the jmp_setup script.

The recommendation is to always use the jmp_setup script to change the date/time on the Junos Space server as the code does all necessary tasks in the background so that the mismatch will not occur.

If there is a mismatch, the following can be done:

Ideally, /var/chroot/mysql/etc/localtime and /etc/localtime should be one and the same on the Junos Space server. If not:

  1. Enter cp /etc/localtime /var/chroot/mysql/etc/localtime .
  2. Enter service mysql restart .
  3. If there are multiple space nodes in the Junos Space fabric, the above changes should be done on all nodes.
  4. Perform a refresh search index once.
After this, any changes to the database should automatically re-index the search database, and the results from the global search should be correct.